Grep through PDF files

While the normal grep utility is great to search text files, it does not work with PDF files.

This is solved by using the pdfgrep utility instead.

For example, to search for a word in a directory of PDF files:

pdfgrep -i -R -P -nn "word"

Where -i will ignore the case, -R will search recursively and -P will use regex mode and -n will print the page number.

Note that searching words will typically yield better results as sentences split into multiple lines don't parse well on many documents.

  • scripts/files/grep_through_pdf_files.txt
  • Last modified: 2023-01-15 22:44
  • by Tony