Hi, I am using pdfgrep to search within a directory of PDF files for a predetermined character string and then then either copy or rsync the files which contain those strings to another directory.
So far I have come up somewhat short, I am able to find and print the files, but have had little success in actually moving them to another directory. I would greatly appreciate any help in pointing out what I am doing wrong and or alternate suggestions.
This finds said strings in the PDFs but doesn't really work to copy the files which contain the strings elsewhere.
Also tried
Printing the output to a list works fine otherwise
So far I have come up somewhat short, I am able to find and print the files, but have had little success in actually moving them to another directory. I would greatly appreciate any help in pointing out what I am doing wrong and or alternate suggestions.
This finds said strings in the PDFs but doesn't really work to copy the files which contain the strings elsewhere.
find . -type f -name '*.pdf' -exec pdfgrep -nHm 2 poliomyelitis {} \; -exec rsync -vr /tmp/test/ \;
Also tried
find . -type f -name '*.pdf' -exec pdfgrep -nHm 2 poliomyelitis {} + rsync -vr /tmp/test/
Printing the output to a list works fine otherwise
find . -type f -name '*.pdf' -exec pdfgrep -nHm 2 poliomyelitis {} + >> output.txt