12

When I want to search a snipet, like searchPart1 some unknown text searchPart2 in a text file, I use searchPart1.*searchPart2. But this is not possible in any pdf reader I use. Currently I convert pdf to a text file and open it using less or geany, then use regular expression available on it.

Is there a Pdf reader with regular expression search other than the commandline pdfgrep

totti
  • 6,908
  • 4
  • 40
  • 48

1 Answers1

10

pdfgrep, in the repos, isn't exactly a reader and requires use of the terminal but it eliminates the need to first convert the pdf file to a text file and then to open that in a capable text editor:

pdfgrep

In addition to the features listed in Synaptic, you can search multiple files and recursively. One big difference from regular grep is that pdfgrep doesn't provide line numbers but page numbers. man pdfgrep has details.

A simple example:

pdfgrep -in PATTERN FILENAME

Here, i is for case-insensitivity and n gives the page number, not line number.

An example of the output looks like:

pdfgrep output

There's a brief YouTube video, Pdfgrep - Search Text Inside PDF Files - Linux CLI , as well.