'\" t
.\" Title: pdfgrep
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.0
.\" Date: 08/10/2014
.\" Manual: Pdfgrep Manual
.\" Source: Pdfgrep 1.3.1
.\" Language: English
.\"
.TH "PDFGREP" "1" "08/10/2014" "Pdfgrep 1\&.3\&.1" "Pdfgrep Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
pdfgrep \- search pdf files for a regular expression
.SH "SYNOPSIS"
.sp
\fBpdfgrep\fR [\fIOPTION\fR\&...] \fIPATTERN\fR \fIFILE\fR\&...
.SH "DESCRIPTION"
.sp
Search for \fIPATTERN\fR in each \fIFILE\fR\&. \fIPATTERN\fR is an extended regular expression\&.
.sp
\fBpdfgrep\fR works much like grep, with one distinction: It operates on pages and not on lines\&.
.SH "OPTIONS"
.PP
\fB\-i\fR, \fB\-\-ignore\-case\fR
.RS 4
Ignore case distinctions in both the
\fIPATTERN\fR
and the input files\&.
.RE
.PP
\fB\-H\fR, \fB\-\-with\-filename\fR
.RS 4
Print the file name for each match\&. This is the default setting when there is more than one file to search\&.
.RE
.PP
\fB\-h\fR, \fB\-\-no\-filename\fR
.RS 4
Suppress the prefixing of file name on output\&. This is the default setting when there is only one file to search\&.
.RE
.PP
\fB\-n\fR, \fB\-\-page\-number\fR
.RS 4
Prefix each match with the number of the page where it was found\&.
.RE
.PP
\fB\-c\fR, \fB\-\-count\fR
.RS 4
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\&.
.RE
.PP
\fB\-p\fR, \fB\-\-page\-count\fR
.RS 4
Like
\fB\-c\fR, but prints the number of matches per page\&.
.RE
.PP
\fB\-C\fR, \fB\-\-context\fR \fINUM\fR
.RS 4
Print at most
\fIINUM\fR
characters of context around each match\&. The exact number will vary, because pdfgrep tries to respect word boundaries\&. If
\fINUM\fR
is "\fBline\fR", 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\&.
.RE
.PP
\fB\-\-color\fR \fIWHEN\fR
.RS 4
Surround file names, page numbers and matched text with escape sequences to display them in color on the terminal\&. (The default setting is
\fBauto\fR)\&.
\fIWHEN\fR
can be:
.PP
\fBalways\fR
.RS 4
Always use colors, even when stdout is not a terminal\&.
.RE
.PP
\fBnever\fR
.RS 4
Do not use colors\&.
.RE
.PP
\fBauto\fR
.RS 4
Use colors only when stdout is a terminal\&.
.RE
.RE
.PP
\fB\-r\fR, \fB\-\-recursive\fR
.RS 4
Recursively search all files (restricted by
\fB\-\-include\fR
and
\fB\-\-exclude\fR) under each directory, following symlinks only if they are on the command line\&.
.RE
.PP
\fB\-R\fR, \fB\-\-dereference\-recursive\fR
.RS 4
Same as
\fB\-r\fR, but follows all symlinks\&.
.RE
.PP
\fB\-\-exclude=\fR\fIGLOB\fR
.RS 4
Skip files whose base name matches
\fIGLOB\fR\&. See
\fIglob\fR(7) for wildcards you can use\&. You can use this option multiple times to exclude more patterns\&. It takes precedence over
\fB\-\-include\fR\&. Note, that in\- and excludes apply only to files found via
\fB\-\-recursive\fR
and not to the argument list\&.
.RE
.PP
\fB\-\-include=\fR\fIGLOB\fR
.RS 4
Only search files whose base name matches
\fIGLOB\fR\&. See
\fB\-\-exclude\fR
for details\&. The default is
\fI*\&.pdf\fR\&.
.RE
.PP
\fB\-\-password=\fR\fIPASSWORD\fR
.RS 4
Use PASSWORD to decrypt the PDF\-files\&.
\fBNote\fR
that this password will show up in your command history and the output of
\fIps\fR(1)\&. So please do not use this if the security of
\fIPASSWORD\fR
is important\&. It is also currently not possible to use individual passwords for different files\&.
.RE
.PP
\fB\-m\fR, \fB\-\-max\-count\fR \fINUM\fR
.RS 4
Stop reading a file after
\fINUM\fR
matching lines\&. When the \-c or \-\-count option is also used, pdfgrep does not output a count greater than
\fINUM\fR\&.
.RE
.PP
\fB\-\-unac\fR
.RS 4
Remove accents and ligatures from both the search pattern and the PDF documents\&. This is useful if you want to search for a word containing "ae", but the PDF uses the single character "æ" instead\&. See
\fBunac(3)\fR
and
\fBunaccent(1)\fR
for details\&.
.sp
\fBThis option is experimental and only available if pdfgrep is compiled with unac support\&.\fR
.RE
.PP
\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
Suppress all normal output to stdout\&. Errors will be printed and the exit codes will be returned (see below)\&.
.RE
.PP
\fB\-\-help\fR
.RS 4
Print a short summary of the options\&.
.RE
.sp
\fB\-V\fR, \fB\-\-version\fR Show version information\&.
.SH "ENVIRONMENT VARIABLES"
.sp
The behavior of \fBpdfgrep\fR is affected by the following environment variable\&.
.PP
\fBGREP_COLORS\fR
.RS 4
Specifies the colors and other attributes used to highlight various parts of the output\&. The syntax and values are like
\fBGREP_COLORS\fR
of
\fBgrep\fR\&. See
\fIgrep\fR(1) for more details\&. Currently only the capabilities
\fBmt\fR,
\fBms\fR,
\fBmc\fR,
\fBfn\fR,
\fBln\fR
and
\fBse\fR
are used by
\fBpdfgrep\fR, where
\fBmt\fR,
\fBms\fR
and
\fBmc\fR
have the same effect on
\fBpdfgrep\fR\&.
.RE
.SH "EXIT STATUS"
.sp
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 \fB\-\-quiet\fR or \fB\-q\fR option is used and a match was found, \fBpdfgrep\fR will return 0 regardless of errors\&.
.SH "AUTHOR"
.sp
Hans\-Peter Deifel
.SH "SEE ALSO"
.sp
grep(1), regex(7)