| 47 |
boundary is controlled by the \fB-N\fP (\fB--newline\fP) option. |
boundary is controlled by the \fB-N\fP (\fB--newline\fP) option. |
| 48 |
.P |
.P |
| 49 |
Patterns are limited to 8K or BUFSIZ characters, whichever is the greater. |
Patterns are limited to 8K or BUFSIZ characters, whichever is the greater. |
| 50 |
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern |
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern |
| 51 |
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to |
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to |
| 52 |
each line in the order in which they are defined, except that all the \fB-e\fP |
each line in the order in which they are defined, except that all the \fB-e\fP |
| 53 |
patterns are tried before the \fB-f\fP patterns. As soon as one pattern matches |
patterns are tried before the \fB-f\fP patterns. As soon as one pattern matches |
| 54 |
(or fails to match when \fB-v\fP is used), no further patterns are considered. |
(or fails to match when \fB-v\fP is used), no further patterns are considered. |
| 55 |
.P |
.P |
| 56 |
When \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP |
When \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP |
| 57 |
is used, the output is the part of the line that matched (either shown |
is used, the output is the part of the line that matched (either shown |
| 58 |
literally, or as an offset). In this case, scanning resumes immediately |
literally, or as an offset). In this case, scanning resumes immediately |
| 59 |
following the match, so that further matches on the same line can be found. |
following the match, so that further matches on the same line can be found. |
| 60 |
If there are multiple patterns, they are all tried on the remainder of the |
If there are multiple patterns, they are all tried on the remainder of the |
| 61 |
line. However, patterns that follow the one that matched are not tried on the |
line. However, patterns that follow the one that matched are not tried on the |
| 62 |
earlier part of the line. |
earlier part of the line. |
| 63 |
.P |
.P |
| 64 |
If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set, |
If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set, |
| 65 |
\fBpcregrep\fP uses the value to set a locale when calling the PCRE library. |
\fBpcregrep\fP uses the value to set a locale when calling the PCRE library. |
| 66 |
The \fB--locale\fP option can be used to override this. |
The \fB--locale\fP option can be used to override this. |
| 67 |
. |
. |
| 68 |
|
.SH "SUPPORT FOR COMPRESSED FILES" |
| 69 |
|
.rs |
| 70 |
|
.sp |
| 71 |
|
It is possible to compile \fBpcregrep\fP so that it uses \fBlibz\fP or |
| 72 |
|
\fBlibbz2\fP to read files whose names end in \fB.gz\fP or \fB.bz2\fP, |
| 73 |
|
respectively. You can find out whether your binary has support for one or both |
| 74 |
|
of these file types by running it with the \fB--help\fP option. If the |
| 75 |
|
appropriate support is not present, files are treated as plain text. The |
| 76 |
|
standard input is always so treated. |
| 77 |
|
. |
| 78 |
.SH OPTIONS |
.SH OPTIONS |
| 79 |
.rs |
.rs |
| 80 |
.TP 10 |
.TP 10 |
| 138 |
are read as if they were ordinary files. In some operating systems the effect |
are read as if they were ordinary files. In some operating systems the effect |
| 139 |
of reading a directory like this is an immediate end-of-file. |
of reading a directory like this is an immediate end-of-file. |
| 140 |
.TP |
.TP |
| 141 |
\fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP |
\fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP |
| 142 |
Specify a pattern to be matched. This option can be used multiple times in |
Specify a pattern to be matched. This option can be used multiple times in |
| 143 |
order to specify several patterns. It can also be used as a way of specifying a |
order to specify several patterns. It can also be used as a way of specifying a |
| 144 |
single pattern that starts with a hyphen. When \fB-e\fP is used, no argument |
single pattern that starts with a hyphen. When \fB-e\fP is used, no argument |
| 178 |
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 file names. There |
| 179 |
is an overall maximum of 100 patterns. Trailing white space is removed from |
is an overall maximum of 100 patterns. Trailing white space is removed from |
| 180 |
each line, and blank lines are ignored. An empty file contains no patterns and |
each line, and blank lines are ignored. An empty file contains no patterns and |
| 181 |
therefore matches nothing. See also the comments about multiple patterns versus |
therefore matches nothing. See also the comments about multiple patterns versus |
| 182 |
a single pattern with alternatives in the description of \fB-e\fP above. |
a single pattern with alternatives in the description of \fB-e\fP above. |
| 183 |
.TP |
.TP |
| 184 |
\fB--file-offsets\fP |
\fB--file-offsets\fP |
| 204 |
name without a space. |
name without a space. |
| 205 |
.TP |
.TP |
| 206 |
\fB--help\fP |
\fB--help\fP |
| 207 |
Output a brief help message and exit. |
Output a help message, giving brief details of the command options and file |
| 208 |
|
type support, and then exit. |
| 209 |
.TP |
.TP |
| 210 |
\fB-i\fP, \fB--ignore-case\fP |
\fB-i\fP, \fB--ignore-case\fP |
| 211 |
Ignore upper/lower case distinctions during comparisons. |
Ignore upper/lower case distinctions during comparisons. |
| 234 |
short form for this option. |
short form for this option. |
| 235 |
.TP |
.TP |
| 236 |
\fB--line-offsets\fP |
\fB--line-offsets\fP |
| 237 |
Instead of showing lines or parts of lines that match, show each match as a |
Instead of showing lines or parts of lines that match, show each match as a |
| 238 |
line number, the offset from the start of the line, and a length. The line |
line number, the offset from the start of the line, and a length. The line |
| 239 |
number is terminated by a colon (as usual; see the \fB-n\fP option), and the |
number is terminated by a colon (as usual; see the \fB-n\fP option), and the |
| 240 |
offset and length are separated by a comma. In this mode, no context is shown. |
offset and length are separated by a comma. In this mode, no context is shown. |
| 241 |
That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is |
That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is |
| 242 |
more than one match in a line, each of them is shown separately. This option is |
more than one match in a line, each of them is shown separately. This option is |
| 282 |
\fB-n\fP, \fB--line-number\fP |
\fB-n\fP, \fB--line-number\fP |
| 283 |
Precede each output line by its line number in the file, followed by a colon |
Precede each output line by its line number in the file, followed by a colon |
| 284 |
and a space for matching lines or a hyphen and a space for context lines. If |
and a space for matching lines or a hyphen and a space for context lines. If |
| 285 |
the filename is also being output, it precedes the line number. This option is |
the filename is also being output, it precedes the line number. This option is |
| 286 |
forced if \fB--line-offsets\fP is used. |
forced if \fB--line-offsets\fP is used. |
| 287 |
.TP |
.TP |
| 288 |
\fB-o\fP, \fB--only-matching\fP |
\fB-o\fP, \fB--only-matching\fP |
| 289 |
Show only the part of the line that matched a pattern. In this mode, no |
Show only the part of the line that matched a pattern. In this mode, no |
| 290 |
context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are |
context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are |
| 291 |
ignored. If there is more than one match in a line, each of them is shown |
ignored. If there is more than one match in a line, each of them is shown |
| 292 |
separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the |
separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the |
| 293 |
match to find non-matching lines), no output is generated, but the return code |
match to find non-matching lines), no output is generated, but the return code |
| 294 |
is set appropriately. This option is mutually exclusive with |
is set appropriately. This option is mutually exclusive with |
| 295 |
\fB--file-offsets\fP and \fB--line-offsets\fP. |
\fB--file-offsets\fP and \fB--line-offsets\fP. |
| 296 |
.TP |
.TP |
| 297 |
\fB-q\fP, \fB--quiet\fP |
\fB-q\fP, \fB--quiet\fP |
| 434 |
.rs |
.rs |
| 435 |
.sp |
.sp |
| 436 |
.nf |
.nf |
| 437 |
Last updated: 07 December 2007 |
Last updated: 17 December 2007 |
| 438 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2007 University of Cambridge. |
| 439 |
.fi |
.fi |