Suppose I have a directory Note_De_cours
containing 8 other directories, i.e.
Semaine_1 Semaine_3 Semaine_5 Semaine_7
Semaine_2 Semaine_4 Semaine_6 Semaine_8
Each of those directories contains some pdf files. Is there a command line to search for a word or set of words in each of those pdf in the same time. It is annoying to open a pdf, press Ctrl + f
and search for the word. I have thought using grep
, but I am really not an expert. Maybe there some other most optimise ways to do that.
I would like to stay in Note_De_Cours
and apply pdfgrep
to see in all the pdf in the same time. I would like the command to tell me which file contains the word or the set of words I want. How can I do that?
EDIT
Can I loop through this command : find elem -iname '*.pdf' -exec pdfgrep "baysien optimal" {} +
on elem
? Something like for elem in ...; do find elem -iname '*.pdf' -exec pdfgrep "baysien optimal" {} +
I have done for i in 1 2 3 4 5 6 7 8; do find Semaine_$i -iname '*.pdf' -exec pdfgrep "taux" {} +; done
but it does not output the file where it comes from
find elem -iname '*.pdf' -exec pdfgrep "baysien optimal" {} +
onelem
? Something likefor elem in ...; do find elem -iname '*.pdf' -exec pdfgrep "baysien optimal" {} +
– David Oct 29 '20 at 17:55find
as you like:find Semaine_* -iname '*.pdf' ...
– L. Scott Johnson Oct 29 '20 at 18:01