How to find pdf files with 2 strings in pdfgrep?

2

0

I use pdfgrep in Fedora 25 and I need to locate pdf files containing "just" two strings: I tried like this but I think it is wrong:

pdfgrep -HiRn 'string 1|string 2' .

How should this command be corrected?

user5666686

Posted 2017-03-08T00:26:28.720

Reputation: 21

Answers

0

Your command looks good. The problem is likely to be the pipe symbol |. Standard grep doesn't handle that without escaping it. Since the man page for pdfgrep says "pdfgrep works much like grep," it may suffer the same syntax limits.

To make it work you will need to escape the | like this \|.

pdfgrep -HiRn 'string 1\|string 2' .

user686699

Posted 2017-03-08T00:26:28.720

Reputation: 1 703