How can I grep through djvu files? They are text files with some images in it. Is there some equivalent to pdfgrep tool?
Asked
Active
Viewed 317 times
3
Pierre B
- 2,143
- 6
- 23
- 38
-
1Maybe there is some better utility for this, but [`djvutxt`](http://djvu.sourceforge.net/doc/man/djvutxt.html) extracts the text layer (if there is one) and you can pipe that to `grep`. – njsg Jul 15 '17 at 13:59
-
Technically, if they contain images they are *not* text files. – Jan Jul 15 '17 at 18:13
1 Answers
0
I installed djvutxt and then I use below script to search. I'm sure it can be improved. I tried a lot of find with exec and xarg commands with better or worse results. This seems to be working best for me.
find . -iname "*djvu" | \
while read I; do
echo "$I"
djvutxt "$I" | grep -i $1
done
save as grepdjvu.sh and run as bash grepdjvu.sh text_to_find.
I copied this script from here https://unix.stackexchange.com/a/50319/322998 and modified.
tr53
- 101