1
How can i grep e move pdf files that containing the string "RELAÇÃO DOS TRABALHADORES" inside? Using ubuntu 14.4.
I already try to use:
grep -i -Z -r -l 'RELAÇÃO DOS TRABALHADORES' . | xargs -I{} mv {} ./destination
grep -lir 'RELAÇÃO DOS TRABALHADORES' target/* | xargs mv -t destionation/
mv `grep -lir 'RELAÇÃO DOS TRABALHADORES' target` destination/
But none of this work, at all. No errors, no outputs, nothing.
Thanks.
I cannot check it at present, but if you can generate correctly the list (put attention to the spaces) then you can pipe to awk and create the command to move them. Mind the
""
before and after the full path and filename. – Hastur – 2016-03-18T13:15:44.900Your main problem is that text in PDF files is encoded, so will never be found by
grep
. @techraf's answer suggests usingpdfgrep
, but other filters are possible, such as usinglesspipe
orpdftotext
. – AFH – 2016-03-18T13:58:25.747