version 1.1.1.1, 2012/02/21 23:05:52
|
version 1.1.1.2, 2012/10/09 09:19:17
|
Line 1
|
Line 1
|
.TH PCREGREP 1 | .TH PCREGREP 1 "04 March 2012" "PCRE 8.31" |
.SH NAME |
.SH NAME |
pcregrep - a grep with Perl-compatible regular expressions. |
pcregrep - a grep with Perl-compatible regular expressions. |
.SH SYNOPSIS |
.SH SYNOPSIS |
Line 95 appropriate support is not present, files are treated
|
Line 95 appropriate support is not present, files are treated
|
standard input is always so treated. |
standard input is always so treated. |
. |
. |
. |
. |
|
.SH "BINARY FILES" |
|
.rs |
|
.sp |
|
By default, a file that contains a binary zero byte within the first 1024 bytes |
|
is identified as a binary file, and is processed specially. (GNU grep also |
|
identifies binary files in this manner.) See the \fB--binary-files\fP option |
|
for a means of changing the way binary files are handled. |
|
. |
|
. |
.SH OPTIONS |
.SH OPTIONS |
.rs |
.rs |
.sp |
.sp |
Line 117 group of lines, unless they are in fact contiguous in
|
Line 126 group of lines, unless they are in fact contiguous in
|
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
guarantees to have up to 8K of following text available for context output. |
guarantees to have up to 8K of following text available for context output. |
.TP |
.TP |
|
\fB-a\fP, \fB--text\fP |
|
Treat binary files as text. This is equivalent to |
|
\fB--binary-files\fP=\fItext\fP. |
|
.TP |
\fB-B\fP \fInumber\fP, \fB--before-context=\fP\fInumber\fP |
\fB-B\fP \fInumber\fP, \fB--before-context=\fP\fInumber\fP |
Output \fInumber\fP lines of context before each matching line. If filenames |
Output \fInumber\fP lines of context before each matching line. If filenames |
and/or line numbers are being output, a hyphen separator is used instead of a |
and/or line numbers are being output, a hyphen separator is used instead of a |
Line 125 group of lines, unless they are in fact contiguous in
|
Line 138 group of lines, unless they are in fact contiguous in
|
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
guarantees to have up to 8K of preceding text available for context output. |
guarantees to have up to 8K of preceding text available for context output. |
.TP |
.TP |
|
\fB--binary-files=\fP\fIword\fP |
|
Specify how binary files are to be processed. If the word is "binary" (the |
|
default), pattern matching is performed on binary files, but the only output is |
|
"Binary file <name> matches" when a match succeeds. If the word is "text", |
|
which is equivalent to the \fB-a\fP or \fB--text\fP option, binary files are |
|
processed in the same way as any other file. In this case, when a match |
|
succeeds, the output may be binary garbage, which can have nasty effects if |
|
sent to a terminal. If the word is "without-match", which is equivalent to the |
|
\fB-I\fP option, binary files are not processed at all; they are assumed not to |
|
be of interest. |
|
.TP |
\fB--buffer-size=\fP\fInumber\fP |
\fB--buffer-size=\fP\fInumber\fP |
Set the parameter that controls how much memory is used for buffering files |
Set the parameter that controls how much memory is used for buffering files |
that are being scanned. |
that are being scanned. |
Line 224 each line of input. A data line is output if any of th
|
Line 248 each line of input. A data line is output if any of th
|
filename can be given as "-" to refer to the standard input. When \fB-f\fP is |
filename can be given as "-" to refer to the standard input. When \fB-f\fP is |
used, patterns specified on the command line using \fB-e\fP may also be |
used, patterns specified on the command line using \fB-e\fP may also be |
present; they are tested before the file's patterns. However, no other pattern |
present; they are tested before the file's patterns. However, no other pattern |
is taken from the command line; all arguments are treated as file names. There | is taken from the command line; all arguments are treated as the names of paths |
is an overall maximum of 100 patterns. Trailing white space is removed from | to be searched. There is an overall maximum of 100 patterns. Trailing white |
each line, and blank lines are ignored. An empty file contains no patterns and | space is removed from each line, and blank lines are ignored. An empty file |
therefore matches nothing. See also the comments about multiple patterns versus | contains no patterns and therefore matches nothing. See also the comments about |
a single pattern with alternatives in the description of \fB-e\fP above. | multiple patterns versus a single pattern with alternatives in the description |
| of \fB-e\fP above. |
.TP |
.TP |
|
\fB--file-list\fP=\fIfilename\fP |
|
Read a list of files to be searched from the given file, one per line. Trailing |
|
white space is removed from each line, and blank lines are ignored. These files |
|
are searched before any others that may be listed on the command line. The |
|
filename can be given as "-" to refer to the standard input. If \fB--file\fP |
|
and \fB--file-list\fP are both specified as "-", patterns are read first. This |
|
is useful only when the standard input is a terminal, from which further lines |
|
(the list of files) can be read after an end-of-file indication. |
|
.TP |
\fB--file-offsets\fP |
\fB--file-offsets\fP |
Instead of showing lines or parts of lines that match, show each match as an |
Instead of showing lines or parts of lines that match, show each match as an |
offset from the start of the file and a length, separated by a comma. In this |
offset from the start of the file and a length, separated by a comma. In this |
Line 255 If a line number is also being output, it follows the
|
Line 289 If a line number is also being output, it follows the
|
Output a help message, giving brief details of the command options and file |
Output a help message, giving brief details of the command options and file |
type support, and then exit. |
type support, and then exit. |
.TP |
.TP |
|
\fB-I\fP |
|
Treat binary files as never matching. This is equivalent to |
|
\fB--binary-files\fP=\fIwithout-match\fP. |
|
.TP |
\fB-i\fP, \fB--ignore-case\fP |
\fB-i\fP, \fB--ignore-case\fP |
Ignore upper/lower case distinctions during comparisons. |
Ignore upper/lower case distinctions during comparisons. |
.TP |
.TP |
Line 483 convert this to an appropriate sequence if the output
|
Line 521 convert this to an appropriate sequence if the output
|
.rs |
.rs |
.sp |
.sp |
Many of the short and long forms of \fBpcregrep\fP's options are the same |
Many of the short and long forms of \fBpcregrep\fP's options are the same |
as in the GNU \fBgrep\fP program (version 2.5.4). Any long option of the form | as in the GNU \fBgrep\fP program. Any long option of the form |
\fB--xxx-regexp\fP (GNU terminology) is also available as \fB--xxx-regex\fP |
\fB--xxx-regexp\fP (GNU terminology) is also available as \fB--xxx-regex\fP |
(PCRE terminology). However, the \fB--file-offsets\fP, \fB--include-dir\fP, | (PCRE terminology). However, the \fB--file-list\fP, \fB--file-offsets\fP, |
\fB--line-offsets\fP, \fB--locale\fP, \fB--match-limit\fP, \fB-M\fP, | \fB--include-dir\fP, \fB--line-offsets\fP, \fB--locale\fP, \fB--match-limit\fP, |
\fB--multiline\fP, \fB-N\fP, \fB--newline\fP, \fB--recursion-limit\fP, | \fB-M\fP, \fB--multiline\fP, \fB-N\fP, \fB--newline\fP, |
\fB-u\fP, and \fB--utf-8\fP options are specific to \fBpcregrep\fP, as is the | \fB--recursion-limit\fP, \fB-u\fP, and \fB--utf-8\fP options are specific to |
use of the \fB--only-matching\fP option with a capturing parentheses number. | \fBpcregrep\fP, as is the use of the \fB--only-matching\fP option with a |
| capturing parentheses number. |
.P |
.P |
Although most of the common options work the same way, a few are different in |
Although most of the common options work the same way, a few are different in |
\fBpcregrep\fP. For example, the \fB--include\fP option's argument is a glob |
\fBpcregrep\fP. For example, the \fB--include\fP option's argument is a glob |
Line 577 Cambridge CB2 3QH, England.
|
Line 616 Cambridge CB2 3QH, England.
|
.rs |
.rs |
.sp |
.sp |
.nf |
.nf |
Last updated: 06 September 2011 | Last updated: 04 March 2012 |
Copyright (c) 1997-2011 University of Cambridge. | Copyright (c) 1997-2012 University of Cambridge. |
.fi |
.fi |