Это работало на windows7+cygwin; искать текст внутри zip-архивов.
c:\> zipgrep "regex" file.epub
сценарий оболочки в c :/cygwin/bin/zipgrep, и это тоже работает:
c:\> unzip -p "*.epub" | grep -a --color regex
-p — труба.
grep -скрипт epub.sh
PAT=${1:?"Usage: grep-epub PAT *.epub files to grep"}
shift
: ${1:?"Need epub files to grep"}
for i in $* ;do
echo $0 $i
unzip -p $i "*.htm*" "*.xml" "*.opf" | # unzip only html and content files to stdin
perl -lpe 's![<][^>]{1,200}?[>]!!g;' | # get rid of small html <b>tags
grep -Pinaso ".{0,60}$PAT.{0,60}" | # keep some context around matches
grep -Pi --color "$PAT" # color the matches.
done