#!/bin/sh # For dumb fucking Calibre splits # Usage: ./find_b_chapters.sh [path_to_epub_root] EPUB_ROOT="${1:-custom/ast/en/OEBPS/Text}" if [ ! -d "$EPUB_ROOT" ]; then echo "Error: Directory '$EPUB_ROOT' not found" >&2 exit 1 fi find "$EPUB_ROOT" -type f -name "Section*B.xhtml" | while read -r file; do basename "$file" echo "$file" done | sort -t'n' -k1.8,1.11n exit 0