Command-line tool
pdfgrep
brew/pdfgrep
Checked 25 Oct 2026, 21:09 UTC · Listing refreshed from Homebrew, winget, npm, Scoop and cargo; npm packages checked against OSV.dev
Search PDFs for strings matching a regular expression
At a glance
- Type
- Command-line tool
- Install on
- macOS, Linux
- Last checked
- 25 Oct 2026, 21:09 UTC
Install it
macOS
brew install pdfgrep
Linux
brew install pdfgrep
Find lines that match pattern in a PDF
pdfgrep pattern file.pdf
Include file name and page number for each matched line
pdfgrep -H -n pattern file.pdf
Do a case-insensitive search for lines that begin with `file_name` and return the first 3 matches
pdfgrep -m 3 -i '^file_name' file.pdf
Related command-line tools
- ansi-regex
Regular Expression for matching ANSI escape codes. - pcregrep
Regular expression pattern matching utility using the same syntax and semantics as Perl 5. - grepwin
Regular expression search and replace tool for Windows. - rxrepl
A command line tool to search and replace text in text files using Perl compatible regular expressions (PCRE). - pomsky
Regular expression language - oniguruma
Regular expressions library - melody
Language that compiles to regular expressions - onigmo
Regular expressions library forked from Oniguruma
Listing text is written by the maker; AptLynx lists tools and does not vouch for them. Find another tool · Browse by topic · For agents