Couldn't find a package for pdf(2|to)te?xt in #FreeBSD, but [pdfgrep] is available.

UPDATE: it's in poppler-utils :D

Easy solution:

pdfgrep . file.pdf > file.txt

😅

(I do have [py311-pdftotext] installed, but it just seems to install a library and not any executables)

pdfgrep « textproc - ports - FreeBSD ports tree

@rl_dane I installed pdfgrep because of this, realized this isn't The Unix Way, found out I have some `pdftotext` installed, and uninstalled pdfgrep.

I can just pipe pdftotext's output to grep. Better, IMO.

@golemwire

pdfgrep is useful for searching directories of PDFs recursively, though.

@rl_dane
`find -print0 | xargs -0tL 1 pdftotext | grep`
might work.

@rl_dane Or maybe
`find -print0 | grep -i '.*\.pdf' | xargs -0tL 1 pdftotext | grep`
to do that and filter for PDFs only (by filename extension).

#shellOneliner

@golemwire

I think it'd be easier to do it all from find:
find . -type f -iname '*.pdf' -exec pdftotext {} + |grep (something)

But then you lose the filenames.

So maybe something more like:

IFS=$'\n' for file in $(find . -type f -iname '*.pdf'); do pdftotext $file |grep (something) |sed "s/^/$file:/" done

OR just use pdfgrep. XD

@rl_dane Yeah I had the verbose option set on xargs (`-t`, not `-v` for whatever reason) to try to print out filenames.
But then you'd get filenames listed for files without any matches....

Maybe pdfgrep is the way to go for this....

Remember that thing we were talking about a long time ago about "icon-driven" interfaces, where the OS has file drivers instead of applications?

If that was done, maybe the driver for PDFs could let you read the PDF as plaintext, then you could just use `grep`.

@golemwire

You mean Apple's #OpenDoc from the 90s (not to be confused with the Open Document format of today)?

That was pretty cool, although I'm pretty sure there wasn't a CLI for it. ;)

@rl_dane I searched to try to find the thread but couldn't find it; I think it may have had to do with your post at https://rldane.space/what-i-do-and-dont-miss-about-macos.html
What I Do and Don't Miss About MacOS

@golemwire

Hmm, sounds like you're either thinking of OpenDoc, or how each file recorded which application created it, and opened the creator application, rather than using per-filetype associations in classic MacOS.

@golemwire

Ah, that's right! You opened Applications by navigating to them and opening them.

There was no concept of an Application Launcher/Program Manager until much later.