| 24 |
|
|
| 25 |
If you attempt to use delimiters (for example, by surrounding a pattern |
If you attempt to use delimiters (for example, by surrounding a pattern |
| 26 |
with slashes, as is common in Perl scripts), they are interpreted as |
with slashes, as is common in Perl scripts), they are interpreted as |
| 27 |
part of the pattern. Quotes can of course be used on the command line |
part of the pattern. Quotes can of course be used to delimit patterns |
| 28 |
because they are interpreted by the shell, and indeed they are required |
on the command line because they are interpreted by the shell, and |
| 29 |
if a pattern contains white space or shell metacharacters. |
indeed they are required if a pattern contains white space or shell |
| 30 |
|
metacharacters. |
| 31 |
The first argument that follows any option settings is treated as the |
|
| 32 |
single pattern to be matched when neither -e nor -f is present. Con- |
The first argument that follows any option settings is treated as the |
| 33 |
versely, when one or both of these options are used to specify pat- |
single pattern to be matched when neither -e nor -f is present. Con- |
| 34 |
|
versely, when one or both of these options are used to specify pat- |
| 35 |
terns, all arguments are treated as path names. At least one of -e, -f, |
terns, all arguments are treated as path names. At least one of -e, -f, |
| 36 |
or an argument pattern must be provided. |
or an argument pattern must be provided. |
| 37 |
|
|
| 38 |
If no files are specified, pcregrep reads the standard input. The stan- |
If no files are specified, pcregrep reads the standard input. The stan- |
| 39 |
dard input can also be referenced by a name consisting of a single |
dard input can also be referenced by a name consisting of a single |
| 40 |
hyphen. For example: |
hyphen. For example: |
| 41 |
|
|
| 42 |
pcregrep some-pattern /file1 - /file3 |
pcregrep some-pattern /file1 - /file3 |
| 43 |
|
|
| 44 |
By default, each line that matches the pattern is copied to the stan- |
By default, each line that matches a pattern is copied to the standard |
| 45 |
dard output, and if there is more than one file, the file name is out- |
output, and if there is more than one file, the file name is output at |
| 46 |
put at the start of each line. However, there are options that can |
the start of each line, followed by a colon. However, there are options |
| 47 |
change how pcregrep behaves. In particular, the -M option makes it pos- |
that can change how pcregrep behaves. In particular, the -M option |
| 48 |
sible to search for patterns that span line boundaries. What defines a |
makes it possible to search for patterns that span line boundaries. |
| 49 |
line boundary is controlled by the -N (--newline) option. |
What defines a line boundary is controlled by the -N (--newline) |
| 50 |
|
option. |
| 51 |
|
|
| 52 |
Patterns are limited to 8K or BUFSIZ characters, whichever is the |
Patterns are limited to 8K or BUFSIZ characters, whichever is the |
| 53 |
greater. BUFSIZ is defined in <stdio.h>. |
greater. BUFSIZ is defined in <stdio.h>. When there is more than one |
| 54 |
|
pattern (specified by the use of -e and/or -f), each pattern is applied |
| 55 |
|
to each line in the order in which they are defined, except that all |
| 56 |
|
the -e patterns are tried before the -f patterns. |
| 57 |
|
|
| 58 |
|
By default, as soon as one pattern matches (or fails to match when -v |
| 59 |
|
is used), no further patterns are considered. However, if --colour (or |
| 60 |
|
--color) is used to colour the matching substrings, or if --only-match- |
| 61 |
|
ing, --file-offsets, or --line-offsets is used to output only the part |
| 62 |
|
of the line that matched (either shown literally, or as an offset), |
| 63 |
|
scanning resumes immediately following the match, so that further |
| 64 |
|
matches on the same line can be found. If there are multiple patterns, |
| 65 |
|
they are all tried on the remainder of the line, but patterns that fol- |
| 66 |
|
low the one that matched are not tried on the earlier part of the line. |
| 67 |
|
|
| 68 |
|
This is the same behaviour as GNU grep, but it does mean that the order |
| 69 |
|
in which multiple patterns are specified can affect the output when one |
| 70 |
|
of the above options is used. |
| 71 |
|
|
| 72 |
|
Patterns that can match an empty string are accepted, but empty string |
| 73 |
|
matches are not recognized. An example is the pattern "(super)?(man)?", |
| 74 |
|
in which all components are optional. This pattern finds all occur- |
| 75 |
|
rences of both "super" and "man"; the output differs from matching with |
| 76 |
|
"super|man" when only the matching substrings are being shown. |
| 77 |
|
|
| 78 |
If the LC_ALL or LC_CTYPE environment variable is set, pcregrep uses |
If the LC_ALL or LC_CTYPE environment variable is set, pcregrep uses |
| 79 |
the value to set a locale when calling the PCRE library. The --locale |
the value to set a locale when calling the PCRE library. The --locale |
| 80 |
option can be used to override this. |
option can be used to override this. |
| 81 |
|
|
| 82 |
|
|
| 83 |
|
SUPPORT FOR COMPRESSED FILES |
| 84 |
|
|
| 85 |
|
It is possible to compile pcregrep so that it uses libz or libbz2 to |
| 86 |
|
read files whose names end in .gz or .bz2, respectively. You can find |
| 87 |
|
out whether your binary has support for one or both of these file types |
| 88 |
|
by running it with the --help option. If the appropriate support is not |
| 89 |
|
present, files are treated as plain text. The standard input is always |
| 90 |
|
so treated. |
| 91 |
|
|
| 92 |
|
|
| 93 |
OPTIONS |
OPTIONS |
| 94 |
|
|
| 95 |
-- This terminate the list of options. It is useful if the next |
-- This terminate the list of options. It is useful if the next |
| 134 |
the same shell item, separated by an equals sign. |
the same shell item, separated by an equals sign. |
| 135 |
|
|
| 136 |
--colour=value, --color=value |
--colour=value, --color=value |
| 137 |
This option specifies under what circumstances the part of a |
This option specifies under what circumstances the parts of a |
| 138 |
line that matched a pattern should be coloured in the output. |
line that matched a pattern should be coloured in the output. |
| 139 |
The value may be "never" (the default), "always", or "auto". |
By default, the output is not coloured. The value (which is |
| 140 |
In the latter case, colouring happens only if the standard |
optional, see above) may be "never", "always", or "auto". In |
| 141 |
output is connected to a terminal. The colour can be speci- |
the latter case, colouring happens only if the standard out- |
| 142 |
fied by setting the environment variable PCREGREP_COLOUR or |
put is connected to a terminal. More resources are used when |
| 143 |
PCREGREP_COLOR. The value of this variable should be a string |
colouring is enabled, because pcregrep has to search for all |
| 144 |
of two numbers, separated by a semicolon. They are copied |
possible matches in a line, not just one, in order to colour |
| 145 |
directly into the control string for setting colour on a ter- |
them all. |
| 146 |
minal, so it is your responsibility to ensure that they make |
|
| 147 |
sense. If neither of the environment variables is set, the |
The colour that is used can be specified by setting the envi- |
| 148 |
default is "1;31", which gives red. |
ronment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value |
| 149 |
|
of this variable should be a string of two numbers, separated |
| 150 |
|
by a semicolon. They are copied directly into the control |
| 151 |
|
string for setting colour on a terminal, so it is your |
| 152 |
|
responsibility to ensure that they make sense. If neither of |
| 153 |
|
the environment variables is set, the default is "1;31", |
| 154 |
|
which gives red. |
| 155 |
|
|
| 156 |
-D action, --devices=action |
-D action, --devices=action |
| 157 |
If an input path is not a regular file or a directory, |
If an input path is not a regular file or a directory, |
| 158 |
"action" specifies how it is to be processed. Valid values |
"action" specifies how it is to be processed. Valid values |
| 159 |
are "read" (the default) or "skip" (silently skip the path). |
are "read" (the default) or "skip" (silently skip the path). |
| 160 |
|
|
| 161 |
-d action, --directories=action |
-d action, --directories=action |
| 162 |
If an input path is a directory, "action" specifies how it is |
If an input path is a directory, "action" specifies how it is |
| 163 |
to be processed. Valid values are "read" (the default), |
to be processed. Valid values are "read" (the default), |
| 164 |
"recurse" (equivalent to the -r option), or "skip" (silently |
"recurse" (equivalent to the -r option), or "skip" (silently |
| 165 |
skip the path). In the default case, directories are read as |
skip the path). In the default case, directories are read as |
| 166 |
if they were ordinary files. In some operating systems the |
if they were ordinary files. In some operating systems the |
| 167 |
effect of reading a directory like this is an immediate end- |
effect of reading a directory like this is an immediate end- |
| 168 |
of-file. |
of-file. |
| 169 |
|
|
| 170 |
-e pattern, --regex=pattern, |
-e pattern, --regex=pattern, --regexp=pattern |
| 171 |
--regexp=pattern Specify a pattern to be matched. This option |
Specify a pattern to be matched. This option can be used mul- |
| 172 |
can be used multiple times in order to specify several pat- |
tiple times in order to specify several patterns. It can also |
| 173 |
terns. It can also be used as a way of specifying a single |
be used as a way of specifying a single pattern that starts |
| 174 |
pattern that starts with a hyphen. When -e is used, no argu- |
with a hyphen. When -e is used, no argument pattern is taken |
| 175 |
ment pattern is taken from the command line; all arguments |
from the command line; all arguments are treated as file |
| 176 |
are treated as file names. There is an overall maximum of 100 |
names. There is an overall maximum of 100 patterns. They are |
| 177 |
patterns. They are applied to each line in the order in which |
applied to each line in the order in which they are defined |
| 178 |
they are defined until one matches (or fails to match if -v |
until one matches (or fails to match if -v is used). If -f is |
| 179 |
is used). If -f is used with -e, the command line patterns |
used with -e, the command line patterns are matched first, |
| 180 |
are matched first, followed by the patterns from the file, |
followed by the patterns from the file, independent of the |
| 181 |
independent of the order in which these options are speci- |
order in which these options are specified. Note that multi- |
| 182 |
fied. Note that multiple use of -e is not the same as a sin- |
ple use of -e is not the same as a single pattern with alter- |
| 183 |
gle pattern with alternatives. For example, X|Y finds the |
natives. For example, X|Y finds the first character in a line |
| 184 |
first character in a line that is X or Y, whereas if the two |
that is X or Y, whereas if the two patterns are given sepa- |
| 185 |
patterns are given separately, pcregrep finds X if it is |
rately, pcregrep finds X if it is present, even if it follows |
| 186 |
present, even if it follows Y in the line. It finds Y only if |
Y in the line. It finds Y only if there is no X in the line. |
| 187 |
there is no X in the line. This really matters only if you |
This really matters only if you are using -o to show the |
| 188 |
are using -o to show the portion of the line that matched. |
part(s) of the line that matched. |
| 189 |
|
|
| 190 |
--exclude=pattern |
--exclude=pattern |
| 191 |
When pcregrep is searching the files in a directory as a con- |
When pcregrep is searching the files in a directory as a con- |
| 192 |
sequence of the -r (recursive search) option, any files whose |
sequence of the -r (recursive search) option, any regular |
| 193 |
names match the pattern are excluded. The pattern is a PCRE |
files whose names match the pattern are excluded. Subdirecto- |
| 194 |
regular expression. If a file name matches both --include and |
ries are not excluded by this option; they are searched |
| 195 |
--exclude, it is excluded. There is no short form for this |
recursively, subject to the --exclude_dir and --include_dir |
| 196 |
|
options. The pattern is a PCRE regular expression, and is |
| 197 |
|
matched against the final component of the file name (not the |
| 198 |
|
entire path). If a file name matches both --include and |
| 199 |
|
--exclude, it is excluded. There is no short form for this |
| 200 |
option. |
option. |
| 201 |
|
|
| 202 |
|
--exclude_dir=pattern |
| 203 |
|
When pcregrep is searching the contents of a directory as a |
| 204 |
|
consequence of the -r (recursive search) option, any subdi- |
| 205 |
|
rectories whose names match the pattern are excluded. (Note |
| 206 |
|
that the --exclude option does not affect subdirectories.) |
| 207 |
|
The pattern is a PCRE regular expression, and is matched |
| 208 |
|
against the final component of the name (not the entire |
| 209 |
|
path). If a subdirectory name matches both --include_dir and |
| 210 |
|
--exclude_dir, it is excluded. There is no short form for |
| 211 |
|
this option. |
| 212 |
|
|
| 213 |
-F, --fixed-strings |
-F, --fixed-strings |
| 214 |
Interpret each pattern as a list of fixed strings, separated |
Interpret each pattern as a list of fixed strings, separated |
| 215 |
by newlines, instead of as a regular expression. The -w |
by newlines, instead of as a regular expression. The -w |
| 216 |
(match as a word) and -x (match whole line) options can be |
(match as a word) and -x (match whole line) options can be |
| 217 |
used with -F. They apply to each of the fixed strings. A line |
used with -F. They apply to each of the fixed strings. A line |
| 218 |
is selected if any of the fixed strings are found in it (sub- |
is selected if any of the fixed strings are found in it (sub- |
| 219 |
ject to -w or -x, if present). |
ject to -w or -x, if present). |
| 220 |
|
|
| 221 |
-f filename, --file=filename |
-f filename, --file=filename |
| 222 |
Read a number of patterns from the file, one per line, and |
Read a number of patterns from the file, one per line, and |
| 223 |
match them against each line of input. A data line is output |
match them against each line of input. A data line is output |
| 224 |
if any of the patterns match it. The filename can be given as |
if any of the patterns match it. The filename can be given as |
| 225 |
"-" to refer to the standard input. When -f is used, patterns |
"-" to refer to the standard input. When -f is used, patterns |
| 226 |
specified on the command line using -e may also be present; |
specified on the command line using -e may also be present; |
| 227 |
they are tested before the file's patterns. However, no other |
they are tested before the file's patterns. However, no other |
| 228 |
pattern is taken from the command line; all arguments are |
pattern is taken from the command line; all arguments are |
| 229 |
treated as file names. There is an overall maximum of 100 |
treated as file names. There is an overall maximum of 100 |
| 230 |
patterns. Trailing white space is removed from each line, and |
patterns. Trailing white space is removed from each line, and |
| 231 |
blank lines are ignored. An empty file contains no patterns |
blank lines are ignored. An empty file contains no patterns |
| 232 |
and therefore matches nothing. |
and therefore matches nothing. See also the comments about |
| 233 |
|
multiple patterns versus a single pattern with alternatives |
| 234 |
|
in the description of -e above. |
| 235 |
|
|
| 236 |
|
--file-offsets |
| 237 |
|
Instead of showing lines or parts of lines that match, show |
| 238 |
|
each match as an offset from the start of the file and a |
| 239 |
|
length, separated by a comma. In this mode, no context is |
| 240 |
|
shown. That is, the -A, -B, and -C options are ignored. If |
| 241 |
|
there is more than one match in a line, each of them is shown |
| 242 |
|
separately. This option is mutually exclusive with --line- |
| 243 |
|
offsets and --only-matching. |
| 244 |
|
|
| 245 |
-H, --with-filename |
-H, --with-filename |
| 246 |
Force the inclusion of the filename at the start of output |
Force the inclusion of the filename at the start of output |
| 247 |
lines when searching a single file. By default, the filename |
lines when searching a single file. By default, the filename |
| 248 |
is not shown in this case. For matching lines, the filename |
is not shown in this case. For matching lines, the filename |
| 249 |
is followed by a colon and a space; for context lines, a |
is followed by a colon; for context lines, a hyphen separator |
| 250 |
hyphen separator is used. If a line number is also being out- |
is used. If a line number is also being output, it follows |
| 251 |
put, it follows the file name without a space. |
the file name. |
| 252 |
|
|
| 253 |
-h, --no-filename |
-h, --no-filename |
| 254 |
Suppress the output filenames when searching multiple files. |
Suppress the output filenames when searching multiple files. |
| 255 |
By default, filenames are shown when multiple files are |
By default, filenames are shown when multiple files are |
| 256 |
searched. For matching lines, the filename is followed by a |
searched. For matching lines, the filename is followed by a |
| 257 |
colon and a space; for context lines, a hyphen separator is |
colon; for context lines, a hyphen separator is used. If a |
| 258 |
used. If a line number is also being output, it follows the |
line number is also being output, it follows the file name. |
|
file name without a space. |
|
| 259 |
|
|
| 260 |
--help Output a brief help message and exit. |
--help Output a help message, giving brief details of the command |
| 261 |
|
options and file type support, and then exit. |
| 262 |
|
|
| 263 |
-i, --ignore-case |
-i, --ignore-case |
| 264 |
Ignore upper/lower case distinctions during comparisons. |
Ignore upper/lower case distinctions during comparisons. |
| 265 |
|
|
| 266 |
--include=pattern |
--include=pattern |
| 267 |
When pcregrep is searching the files in a directory as a con- |
When pcregrep is searching the files in a directory as a con- |
| 268 |
sequence of the -r (recursive search) option, only those |
sequence of the -r (recursive search) option, only those reg- |
| 269 |
files whose names match the pattern are included. The pattern |
ular files whose names match the pattern are included. Subdi- |
| 270 |
is a PCRE regular expression. If a file name matches both |
rectories are always included and searched recursively, sub- |
| 271 |
--include and --exclude, it is excluded. There is no short |
ject to the --include_dir and --exclude_dir options. The pat- |
| 272 |
form for this option. |
tern is a PCRE regular expression, and is matched against the |
| 273 |
|
final component of the file name (not the entire path). If a |
| 274 |
|
file name matches both --include and --exclude, it is |
| 275 |
|
excluded. There is no short form for this option. |
| 276 |
|
|
| 277 |
|
--include_dir=pattern |
| 278 |
|
When pcregrep is searching the contents of a directory as a |
| 279 |
|
consequence of the -r (recursive search) option, only those |
| 280 |
|
subdirectories whose names match the pattern are included. |
| 281 |
|
(Note that the --include option does not affect subdirecto- |
| 282 |
|
ries.) The pattern is a PCRE regular expression, and is |
| 283 |
|
matched against the final component of the name (not the |
| 284 |
|
entire path). If a subdirectory name matches both |
| 285 |
|
--include_dir and --exclude_dir, it is excluded. There is no |
| 286 |
|
short form for this option. |
| 287 |
|
|
| 288 |
-L, --files-without-match |
-L, --files-without-match |
| 289 |
Instead of outputting lines from the files, just output the |
Instead of outputting lines from the files, just output the |
| 303 |
when file names are being output. If not supplied, "(standard |
when file names are being output. If not supplied, "(standard |
| 304 |
input)" is used. There is no short form for this option. |
input)" is used. There is no short form for this option. |
| 305 |
|
|
| 306 |
|
--line-offsets |
| 307 |
|
Instead of showing lines or parts of lines that match, show |
| 308 |
|
each match as a line number, the offset from the start of the |
| 309 |
|
line, and a length. The line number is terminated by a colon |
| 310 |
|
(as usual; see the -n option), and the offset and length are |
| 311 |
|
separated by a comma. In this mode, no context is shown. |
| 312 |
|
That is, the -A, -B, and -C options are ignored. If there is |
| 313 |
|
more than one match in a line, each of them is shown sepa- |
| 314 |
|
rately. This option is mutually exclusive with --file-offsets |
| 315 |
|
and --only-matching. |
| 316 |
|
|
| 317 |
--locale=locale-name |
--locale=locale-name |
| 318 |
This option specifies a locale to be used for pattern match- |
This option specifies a locale to be used for pattern match- |
| 319 |
ing. It overrides the value in the LC_ALL or LC_CTYPE envi- |
ing. It overrides the value in the LC_ALL or LC_CTYPE envi- |
| 337 |
lookbehind assertions. |
lookbehind assertions. |
| 338 |
|
|
| 339 |
-N newline-type, --newline=newline-type |
-N newline-type, --newline=newline-type |
| 340 |
The PCRE library supports four different conventions for |
The PCRE library supports five different conventions for |
| 341 |
indicating the ends of lines. They are the single-character |
indicating the ends of lines. They are the single-character |
| 342 |
sequences CR (carriage return) and LF (linefeed), the two- |
sequences CR (carriage return) and LF (linefeed), the two- |
| 343 |
character sequence CRLF, and an "any" convention, in which |
character sequence CRLF, an "anycrlf" convention, which rec- |
| 344 |
any Unicode line ending sequence is assumed to end a line. |
ognizes any of the preceding three types, and an "any" con- |
| 345 |
The Unicode sequences are the three just mentioned, plus VT |
vention, in which any Unicode line ending sequence is assumed |
| 346 |
(vertical tab, U+000B), FF (formfeed, U+000C), NEL (next |
to end a line. The Unicode sequences are the three just men- |
| 347 |
line, U+0085), LS (line separator, U+2028), and PS (paragraph |
tioned, plus VT (vertical tab, U+000B), FF (formfeed, |
| 348 |
separator, U+0029). |
U+000C), NEL (next line, U+0085), LS (line separator, |
| 349 |
|
U+2028), and PS (paragraph separator, U+2029). |
| 350 |
|
|
| 351 |
When the PCRE library is built, a default line-ending |
When the PCRE library is built, a default line-ending |
| 352 |
sequence is specified. This is normally the standard |
sequence is specified. This is normally the standard |
| 353 |
sequence for the operating system. Unless otherwise specified |
sequence for the operating system. Unless otherwise specified |
| 354 |
by this option, pcregrep uses the library's default. The |
by this option, pcregrep uses the library's default. The |
| 355 |
possible values for this option are CR, LF, CRLF, or ANY. |
possible values for this option are CR, LF, CRLF, ANYCRLF, or |
| 356 |
This makes it possible to use pcregrep on files that have |
ANY. This makes it possible to use pcregrep on files that |
| 357 |
come from other environments without having to modify their |
have come from other environments without having to modify |
| 358 |
line endings. If the data that is being scanned does not |
their line endings. If the data that is being scanned does |
| 359 |
agree with the convention set by this option, pcregrep may |
not agree with the convention set by this option, pcregrep |
| 360 |
behave in strange ways. |
may behave in strange ways. |
| 361 |
|
|
| 362 |
-n, --line-number |
-n, --line-number |
| 363 |
Precede each output line by its line number in the file, fol- |
Precede each output line by its line number in the file, fol- |
| 364 |
lowed by a colon and a space for matching lines or a hyphen |
lowed by a colon for matching lines or a hyphen for context |
| 365 |
and a space for context lines. If the filename is also being |
lines. If the filename is also being output, it precedes the |
| 366 |
output, it precedes the line number. |
line number. This option is forced if --line-offsets is used. |
| 367 |
|
|
| 368 |
-o, --only-matching |
-o, --only-matching |
| 369 |
Show only the part of the line that matched a pattern. In |
Show only the part of the line that matched a pattern. In |
| 370 |
this mode, no context is shown. That is, the -A, -B, and -C |
this mode, no context is shown. That is, the -A, -B, and -C |
| 371 |
options are ignored. |
options are ignored. If there is more than one match in a |
| 372 |
|
line, each of them is shown separately. If -o is combined |
| 373 |
|
with -v (invert the sense of the match to find non-matching |
| 374 |
|
lines), no output is generated, but the return code is set |
| 375 |
|
appropriately. This option is mutually exclusive with --file- |
| 376 |
|
offsets and --line-offsets. |
| 377 |
|
|
| 378 |
-q, --quiet |
-q, --quiet |
| 379 |
Work quietly, that is, display nothing except error messages. |
Work quietly, that is, display nothing except error messages. |
| 465 |
Note, however, that if you want to supply a file name beginning with ~ |
Note, however, that if you want to supply a file name beginning with ~ |
| 466 |
as data in a shell command, and have the shell expand ~ to a home |
as data in a shell command, and have the shell expand ~ to a home |
| 467 |
directory, you must separate the file name from the option, because the |
directory, you must separate the file name from the option, because the |
| 468 |
shell does not treat ~ specially unless it is at the start of an item. |
shell does not treat ~ specially unless it is at the start of an item. |
| 469 |
|
|
| 470 |
The exception to the above is the --colour (or --color) option, for |
The exception to the above is the --colour (or --color) option, for |
| 471 |
which the data is optional. If this option does have data, it must be |
which the data is optional. If this option does have data, it must be |
| 472 |
given in the first form, using an equals character. Otherwise it will |
given in the first form, using an equals character. Otherwise it will |
| 473 |
be assumed that it has no data. |
be assumed that it has no data. |
| 474 |
|
|
| 475 |
|
|
| 476 |
MATCHING ERRORS |
MATCHING ERRORS |
| 477 |
|
|
| 478 |
It is possible to supply a regular expression that takes a very long |
It is possible to supply a regular expression that takes a very long |
| 479 |
time to fail to match certain lines. Such patterns normally involve |
time to fail to match certain lines. Such patterns normally involve |
| 480 |
nested indefinite repeats, for example: (a+)*\d when matched against a |
nested indefinite repeats, for example: (a+)*\d when matched against a |
| 481 |
line of a's with no final digit. The PCRE matching function has a |
line of a's with no final digit. The PCRE matching function has a |
| 482 |
resource limit that causes it to abort in these circumstances. If this |
resource limit that causes it to abort in these circumstances. If this |
| 483 |
happens, pcregrep outputs an error message and the line that caused the |
happens, pcregrep outputs an error message and the line that caused the |
| 484 |
problem to the standard error stream. If there are more than 20 such |
problem to the standard error stream. If there are more than 20 such |
| 485 |
errors, pcregrep gives up. |
errors, pcregrep gives up. |
| 486 |
|
|
| 487 |
|
|
| 488 |
DIAGNOSTICS |
DIAGNOSTICS |
| 489 |
|
|
| 490 |
Exit status is 0 if any matches were found, 1 if no matches were found, |
Exit status is 0 if any matches were found, 1 if no matches were found, |
| 491 |
and 2 for syntax errors and non-existent or inacessible files (even if |
and 2 for syntax errors and non-existent or inacessible files (even if |
| 492 |
matches were found in other files) or too many matching errors. Using |
matches were found in other files) or too many matching errors. Using |
| 493 |
the -s option to suppress error messages about inaccessble files does |
the -s option to suppress error messages about inaccessble files does |
| 494 |
not affect the return code. |
not affect the return code. |
| 495 |
|
|
| 496 |
|
|
| 508 |
|
|
| 509 |
REVISION |
REVISION |
| 510 |
|
|
| 511 |
Last updated: 06 March 2007 |
Last updated: 01 March 2009 |
| 512 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2009 University of Cambridge. |