2

I need to find LaTeX Generated PDF files because I want to find those files made by me. I think find could possibly work here.

OS X El-Capitan

I run Ulrich's proposal find BitTorrentSync/ -exec pdfinfo {} + |grep pdftex but I get

find: pdfinfo: No such file or directory
find: pdfinfo: No such file or directory
...

where the problem is that I do not have pdfinfo yet in my system.

L.Levrel's proposal. I run gfind -name '*.pdf' | gxargs ggrep -al '^/Producer (pdfTeX' where I use GNU's products but I get in OS X El-Capitan

gxargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option
ggrep: cademic: invalid context length argument

Ubuntu 16.04

I cannot run Ulrich's proposal because of the bug here. L.Levrel's first proposal does not work but it works with xargs -0

find -name '*.pdf' | xargs -0 grep -al '^/Producer (pdfTeX'

How can you find LaTeX generated PDF files?

2 Answers2

3

You can look at the "/Producer" line:

find -name '*.pdf' | xargs grep -al '^/Producer (pdfTeX'

or with double quotes

find -name '*.pdf' | xargs grep -al "^/Producer (pdfTeX"

or with null-separated list of files

find -name '*.pdf' -print0 | xargs -0 grep -al '^/Producer (pdfTeX'
L. Levrel
  • 1,503
1

Based on L.Levrel response, using the tools supplied in OS X (this should also work in Ubuntu).

find . -type f -name '*.pdf' -exec grep -alE '/Producer \(pdfTeX|/Producer\(pdfTeX' {} +
fd0
  • 1,449