| 46 |
possible to search for patterns that span line boundaries. What defines a line |
possible to search for patterns that span line boundaries. What defines a line |
| 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. |
The amount of memory used for buffering files that are being scanned is |
| 50 |
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern |
controlled by a parameter that can be set by the \fB--buffer-size\fP option. |
| 51 |
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to |
The default value for this parameter is specified when \fBpcregrep\fP is built, |
| 52 |
each line in the order in which they are defined, except that all the \fB-e\fP |
with the default default being 20K. A block of memory three times this size is |
| 53 |
patterns are tried before the \fB-f\fP patterns. |
used (to allow for buffering "before" and "after" lines). An error occurs if a |
| 54 |
|
line overflows the buffer. |
| 55 |
|
.P |
| 56 |
|
Patterns are limited to 8K or BUFSIZ bytes, whichever is the greater. BUFSIZ is |
| 57 |
|
defined in \fB<stdio.h>\fP. When there is more than one pattern (specified by |
| 58 |
|
the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to each line in |
| 59 |
|
the order in which they are defined, except that all the \fB-e\fP patterns are |
| 60 |
|
tried before the \fB-f\fP patterns. |
| 61 |
.P |
.P |
| 62 |
By default, as soon as one pattern matches (or fails to match when \fB-v\fP is |
By default, as soon as one pattern matches (or fails to match when \fB-v\fP is |
| 63 |
used), no further patterns are considered. However, if \fB--colour\fP (or |
used), no further patterns are considered. However, if \fB--colour\fP (or |
| 93 |
appropriate support is not present, files are treated as plain text. The |
appropriate support is not present, files are treated as plain text. The |
| 94 |
standard input is always so treated. |
standard input is always so treated. |
| 95 |
. |
. |
| 96 |
|
. |
| 97 |
.SH OPTIONS |
.SH OPTIONS |
| 98 |
.rs |
.rs |
| 99 |
.sp |
.sp |
| 100 |
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 |
| 101 |
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 |
| 102 |
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 |
| 103 |
effect. |
effect. Numerical values for options may be followed by K or M, to signify |
| 104 |
|
multiplication by 1024 or 1024*1024 respectively. |
| 105 |
.TP 10 |
.TP 10 |
| 106 |
\fB--\fP |
\fB--\fP |
| 107 |
This terminate the list of options. It is useful if the next item on the |
This terminates the list of options. It is useful if the next item on the |
| 108 |
command line starts with a hyphen but is not an option. This allows for the |
command line starts with a hyphen but is not an option. This allows for the |
| 109 |
processing of patterns and filenames that start with hyphens. |
processing of patterns and filenames that start with hyphens. |
| 110 |
.TP |
.TP |
| 124 |
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP |
| 125 |
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. |
| 126 |
.TP |
.TP |
| 127 |
|
\fB--buffer-size=\fP\fInumber\fP |
| 128 |
|
Set the parameter that controls how much memory is used for buffering files |
| 129 |
|
that are being scanned. |
| 130 |
|
.TP |
| 131 |
\fB-C\fP \fInumber\fP, \fB--context=\fP\fInumber\fP |
\fB-C\fP \fInumber\fP, \fB--context=\fP\fInumber\fP |
| 132 |
Output \fInumber\fP lines of context both before and after each matching line. |
Output \fInumber\fP lines of context both before and after each matching line. |
| 133 |
This is equivalent to setting both \fB-A\fP and \fB-B\fP to the same value. |
This is equivalent to setting both \fB-A\fP and \fB-B\fP to the same value. |
| 543 |
.rs |
.rs |
| 544 |
.sp |
.sp |
| 545 |
Exit status is 0 if any matches were found, 1 if no matches were found, and 2 |
Exit status is 0 if any matches were found, 1 if no matches were found, and 2 |
| 546 |
for syntax errors and non-existent or inaccessible files (even if matches were |
for syntax errors, overlong lines, non-existent or inaccessible files (even if |
| 547 |
found in other files) or too many matching errors. Using the \fB-s\fP option to |
matches were found in other files) or too many matching errors. Using the |
| 548 |
suppress error messages about inaccessible files does not affect the return |
\fB-s\fP option to suppress error messages about inaccessible files does not |
| 549 |
code. |
affect the return code. |
| 550 |
. |
. |
| 551 |
. |
. |
| 552 |
.SH "SEE ALSO" |
.SH "SEE ALSO" |
| 569 |
.rs |
.rs |
| 570 |
.sp |
.sp |
| 571 |
.nf |
.nf |
| 572 |
Last updated: 07 May 2011 |
Last updated: 30 July 2011 |
| 573 |
Copyright (c) 1997-2011 University of Cambridge. |
Copyright (c) 1997-2011 University of Cambridge. |
| 574 |
.fi |
.fi |