Langue: en

Version: 331822 (ubuntu - 24/10/10)

Section: 1 (Commandes utilisateur)


pdfgrep - search pdf files for a regular expression


pdfgrep [OPTION...] PATTERN FILE...


Search for PATTERN in each FILE. PATTERN is an extended regular expression.

pdfgrep works much like grep, with one distinction: It operates on pages and not on lines.


-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input files.
-H, --with-filename
Print the file name for each match. This is the default setting when there is more than one file to search.
-h, --no-filename
Suppress the prefixing of file name on output. This is the default setting when there is only one file to search.
-n, --page-number
Prefix each match with the number of the page where it was found.
-c, --count
Suppress normal output. Instead print the number of matches for each input file. Note that unlike grep, multiple matches on the same page will be counted individually.
-C, --context NUM
Print at most NUM characters of context around each match. The exact number will vary, because pdfgrep tries to respect word boundaries. If NUM is "line", the whole line will be printed. If this option is not set, pdfgrep tries to print lines that are not longer than the terminal width.
--color WHEN
Surround file names, page numbers and matched text with escape sequences to display them in color on the terminal. (The default setting is auto).

WHEN can be:
Always use colors, even when stdout is not a terminal.
Do not use colors.
Use colors only when stdout is a terminal.
-q, --quiet
Suppress all normal output to stdout. Errors will be printed and the exit codes will be returned (see below).
Print a short summary of the options.
-V, --version
Show version information


The behavior of pdfgrep is affected by the following environment variable.
Specifies the colors and other attributes used to highlight various parts of the output. The syntax and values are like GREP_COLORS of grep. See grep(1) for more details. Currently only the capabilities mt, ms, mc, fn, ln and se are used by pdfgrep, where mt, ms and mc have the same effect on pdfgrep.


Normally, the exit status is 0 if at least one match is found, 1 if no match is found and 2 if an error occurred. But if the --quiet or -q option is used and a match was found, pdfgrep will return 0 regardless of errors.


Hans-Peter Deifel <hpdeifel at gmx.de>


grep(1), regex(7)