How to search contents of multiple pdf files?

后端 未结 13 1171
误落风尘
误落风尘 2020-11-30 15:58

How could I search the contents of PDF files in a directory/subdirectory? I am looking for some command line tools. It seems that grep can\'t search PDF files.<

13条回答
  •  清歌不尽
    2020-11-30 16:47

    I like @sjr's answer however I prefer xargs vs -exec. I find xargs more versatile. For example with -P we can take advantage of multiple CPUs when it makes sense to do so.

    find . -name '*.pdf' | xargs -P 5 -I % pdftotext % - | grep --with-filename --label="{}" --color "pattern"
    

提交回复
热议问题