| 67 |
above options is used. |
above options is used. |
| 68 |
.P |
.P |
| 69 |
Patterns that can match an empty string are accepted, but empty string |
Patterns that can match an empty string are accepted, but empty string |
| 70 |
matches are not recognized. An example is the pattern "(super)?(man)?", in |
matches are never recognized. An example is the pattern "(super)?(man)?", in |
| 71 |
which all components are optional. This pattern finds all occurrences of both |
which all components are optional. This pattern finds all occurrences of both |
| 72 |
"super" and "man"; the output differs from matching with "super|man" when only |
"super" and "man"; the output differs from matching with "super|man" when only |
| 73 |
the matching substrings are being shown. |
the matching substrings are being shown. |
| 89 |
.SH OPTIONS |
.SH OPTIONS |
| 90 |
.rs |
.rs |
| 91 |
.sp |
.sp |
| 92 |
The order in which some of the options appear can affect the output. For |
The order in which some of the options appear can affect the output. For |
| 93 |
example, both the \fB-h\fP and \fB-l\fP options affect the printing of file |
example, both the \fB-h\fP and \fB-l\fP options affect the printing of file |
| 94 |
names. Whichever comes later in the command line will be the one that takes |
names. Whichever comes later in the command line will be the one that takes |
| 95 |
effect. |
effect. |
| 96 |
.TP 10 |
.TP 10 |
| 97 |
\fB--\fP |
\fB--\fP |
| 141 |
connected to a terminal. More resources are used when colouring is enabled, |
connected to a terminal. More resources are used when colouring is enabled, |
| 142 |
because \fBpcregrep\fP has to search for all possible matches in a line, not |
because \fBpcregrep\fP has to search for all possible matches in a line, not |
| 143 |
just one, in order to colour them all. |
just one, in order to colour them all. |
| 144 |
|
.sp |
| 145 |
The colour that is used can be specified by setting the environment variable |
The colour that is used can be specified by setting the environment variable |
| 146 |
PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a |
PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a |
| 147 |
string of two numbers, separated by a semicolon. They are copied directly into |
string of two numbers, separated by a semicolon. They are copied directly into |
| 272 |
Instead of outputting lines from the files, just output the names of the files |
Instead of outputting lines from the files, just output the names of the files |
| 273 |
containing lines that would have been output. Each file name is output |
containing lines that would have been output. Each file name is output |
| 274 |
once, on a separate line. Searching normally stops as soon as a matching line |
once, on a separate line. Searching normally stops as soon as a matching line |
| 275 |
is found in a file. However, if the \fB-c\fP (count) option is also used, |
is found in a file. However, if the \fB-c\fP (count) option is also used, |
| 276 |
matching continues in order to obtain the correct count, and those files that |
matching continues in order to obtain the correct count, and those files that |
| 277 |
have at least one match are listed along with their counts. Using this option |
have at least one match are listed along with their counts. Using this option |
| 278 |
with \fB-c\fP is a way of suppressing the listing of files with no matches. |
with \fB-c\fP is a way of suppressing the listing of files with no matches. |
| 279 |
.TP |
.TP |
| 280 |
\fB--label\fP=\fIname\fP |
\fB--label\fP=\fIname\fP |
| 282 |
are being output. If not supplied, "(standard input)" is used. There is no |
are being output. If not supplied, "(standard input)" is used. There is no |
| 283 |
short form for this option. |
short form for this option. |
| 284 |
.TP |
.TP |
| 285 |
|
\fB--line-buffered\fP |
| 286 |
|
When this option is given, input is read and processed line by line, and the |
| 287 |
|
output is flushed after each write. By default, input is read in large chunks, |
| 288 |
|
unless \fBpcregrep\fP can determine that it is reading from a terminal (which |
| 289 |
|
is currently possible only in Unix environments). Output to terminal is |
| 290 |
|
normally automatically flushed by the operating system. This option can be |
| 291 |
|
useful when the input or output is attached to a pipe and you do not want |
| 292 |
|
\fBpcregrep\fP to buffer up large amounts of data. However, its use will affect |
| 293 |
|
performance, and the \fB-M\fP (multiline) option ceases to work. |
| 294 |
|
.TP |
| 295 |
\fB--line-offsets\fP |
\fB--line-offsets\fP |
| 296 |
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 |
| 297 |
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 |
| 317 |
\fBpcregrep\fP ensures that at least 8K characters or the rest of the document |
\fBpcregrep\fP ensures that at least 8K characters or the rest of the document |
| 318 |
(whichever is the shorter) are available for forward matching, and similarly |
(whichever is the shorter) are available for forward matching, and similarly |
| 319 |
the previous 8K characters (or all the previous characters, if fewer than 8K) |
the previous 8K characters (or all the previous characters, if fewer than 8K) |
| 320 |
are guaranteed to be available for lookbehind assertions. |
are guaranteed to be available for lookbehind assertions. This option does not |
| 321 |
|
work when input is read line by line (see \fP--line-buffered\fP.) |
| 322 |
.TP |
.TP |
| 323 |
\fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP |
\fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP |
| 324 |
The PCRE library supports five different conventions for indicating |
The PCRE library supports five different conventions for indicating |
| 421 |
as in the GNU \fBgrep\fP program. Any long option of the form |
as in the GNU \fBgrep\fP program. Any long option of the form |
| 422 |
\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 |
| 423 |
(PCRE terminology). However, the \fB--locale\fP, \fB-M\fP, \fB--multiline\fP, |
(PCRE terminology). However, the \fB--locale\fP, \fB-M\fP, \fB--multiline\fP, |
| 424 |
\fB-u\fP, and \fB--utf-8\fP options are specific to \fBpcregrep\fP. If both the |
\fB-u\fP, and \fB--utf-8\fP options are specific to \fBpcregrep\fP. If both the |
| 425 |
\fB-c\fP and \fB-l\fP options are given, GNU grep lists only file names, |
\fB-c\fP and \fB-l\fP options are given, GNU grep lists only file names, |
| 426 |
without counts, but \fBpcregrep\fP gives the counts. |
without counts, but \fBpcregrep\fP gives the counts. |
| 427 |
. |
. |
| 428 |
. |
. |
| 496 |
.rs |
.rs |
| 497 |
.sp |
.sp |
| 498 |
.nf |
.nf |
| 499 |
Last updated: 12 August 2009 |
Last updated: 21 May 2010 |
| 500 |
Copyright (c) 1997-2009 University of Cambridge. |
Copyright (c) 1997-2010 University of Cambridge. |
| 501 |
.fi |
.fi |