Aware that pdf can be read into the terminal using The Poppler Developers tools.

One of the tools which helps in checking for a pattern in the pdf and then printing in the terminal is


Suppose say, I am interested in the word "Happy" in a set of PDF files in the current working directory. I also wish to get the context in which Happy word has been used in all the PDFs. We can use the following code to print 2 lines above and 2 lines below the word 'Happy' in all the PDF in the directory using the following code

pdfgrep 'Happy' * -H  -A 2 -B 2

Now my question is not this. I want to highlight the word Happy in all the PDF present in my directory through the terminal

I am adding the required output to make things more clear.

In the attached PDF which is one among the many in the directory, I need this kind of output to be made.

Any ideas on ways to execute this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.