| 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. As soon as one pat- |
| 57 |
|
tern matches (or fails to match when -v is used), no further patterns |
| 58 |
|
are considered. |
| 59 |
|
|
| 60 |
|
When --only-matching, --file-offsets, or --line-offsets is used, the |
| 61 |
|
output is the part of the line that matched (either shown literally, or |
| 62 |
|
as an offset). In this case, scanning resumes immediately following the |
| 63 |
|
match, so that further matches on the same line can be found. If there |
| 64 |
|
are multiple patterns, they are all tried on the remainder of the line. |
| 65 |
|
However, patterns that follow the one that matched are not tried on the |
| 66 |
|
earlier part of the line. |
| 67 |
|
|
| 68 |
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 |
| 69 |
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 |
| 70 |
option can be used to override this. |
option can be used to override this. |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
SUPPORT FOR COMPRESSED FILES |
| 74 |
|
|
| 75 |
|
It is possible to compile pcregrep so that it uses libz or libbz2 to |
| 76 |
|
read files whose names end in .gz or .bz2, respectively. You can find |
| 77 |
|
out whether your binary has support for one or both of these file types |
| 78 |
|
by running it with the --help option. If the appropriate support is not |
| 79 |
|
present, files are treated as plain text. The standard input is always |
| 80 |
|
so treated. |
| 81 |
|
|
| 82 |
|
|
| 83 |
OPTIONS |
OPTIONS |
| 84 |
|
|
| 85 |
-- This terminate the list of options. It is useful if the next |
-- This terminate the list of options. It is useful if the next |
| 151 |
effect of reading a directory like this is an immediate end- |
effect of reading a directory like this is an immediate end- |
| 152 |
of-file. |
of-file. |
| 153 |
|
|
| 154 |
-e pattern, --regex=pattern, |
-e pattern, --regex=pattern, --regexp=pattern |
| 155 |
--regexp=pattern Specify a pattern to be matched. This option |
Specify a pattern to be matched. This option can be used mul- |
| 156 |
can be used multiple times in order to specify several pat- |
tiple times in order to specify several patterns. It can also |
| 157 |
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 |
| 158 |
pattern that starts with a hyphen. When -e is used, no argu- |
with a hyphen. When -e is used, no argument pattern is taken |
| 159 |
ment pattern is taken from the command line; all arguments |
from the command line; all arguments are treated as file |
| 160 |
are treated as file names. There is an overall maximum of 100 |
names. There is an overall maximum of 100 patterns. They are |
| 161 |
patterns. They are applied to each line in the order in which |
applied to each line in the order in which they are defined |
| 162 |
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 |
| 163 |
is used). If -f is used with -e, the command line patterns |
used with -e, the command line patterns are matched first, |
| 164 |
are matched first, followed by the patterns from the file, |
followed by the patterns from the file, independent of the |
| 165 |
independent of the order in which these options are speci- |
order in which these options are specified. Note that multi- |
| 166 |
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- |
| 167 |
gle pattern with alternatives. For example, X|Y finds the |
natives. For example, X|Y finds the first character in a line |
| 168 |
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- |
| 169 |
patterns are given separately, pcregrep finds X if it is |
rately, pcregrep finds X if it is present, even if it follows |
| 170 |
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. |
| 171 |
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 |
| 172 |
are using -o to show the portion of the line that matched. |
part(s) of the line that matched. |
| 173 |
|
|
| 174 |
--exclude=pattern |
--exclude=pattern |
| 175 |
When pcregrep is searching the files in a directory as a con- |
When pcregrep is searching the files in a directory as a con- |
| 198 |
treated as file names. There is an overall maximum of 100 |
treated as file names. There is an overall maximum of 100 |
| 199 |
patterns. Trailing white space is removed from each line, and |
patterns. Trailing white space is removed from each line, and |
| 200 |
blank lines are ignored. An empty file contains no patterns |
blank lines are ignored. An empty file contains no patterns |
| 201 |
and therefore matches nothing. |
and therefore matches nothing. See also the comments about |
| 202 |
|
multiple patterns versus a single pattern with alternatives |
| 203 |
|
in the description of -e above. |
| 204 |
|
|
| 205 |
|
--file-offsets |
| 206 |
|
Instead of showing lines or parts of lines that match, show |
| 207 |
|
each match as an offset from the start of the file and a |
| 208 |
|
length, separated by a comma. In this mode, no context is |
| 209 |
|
shown. That is, the -A, -B, and -C options are ignored. If |
| 210 |
|
there is more than one match in a line, each of them is shown |
| 211 |
|
separately. This option is mutually exclusive with --line- |
| 212 |
|
offsets and --only-matching. |
| 213 |
|
|
| 214 |
-H, --with-filename |
-H, --with-filename |
| 215 |
Force the inclusion of the filename at the start of output |
Force the inclusion of the filename at the start of output |
| 227 |
used. If a line number is also being output, it follows the |
used. If a line number is also being output, it follows the |
| 228 |
file name without a space. |
file name without a space. |
| 229 |
|
|
| 230 |
--help Output a brief help message and exit. |
--help Output a help message, giving brief details of the command |
| 231 |
|
options and file type support, and then exit. |
| 232 |
|
|
| 233 |
-i, --ignore-case |
-i, --ignore-case |
| 234 |
Ignore upper/lower case distinctions during comparisons. |
Ignore upper/lower case distinctions during comparisons. |
| 235 |
|
|
| 236 |
--include=pattern |
--include=pattern |
| 237 |
When pcregrep is searching the files in a directory as a con- |
When pcregrep is searching the files in a directory as a con- |
| 238 |
sequence of the -r (recursive search) option, only those |
sequence of the -r (recursive search) option, only those |
| 239 |
files whose names match the pattern are included. The pattern |
files whose names match the pattern are included. The pattern |
| 240 |
is a PCRE regular expression. If a file name matches both |
is a PCRE regular expression. If a file name matches both |
| 241 |
--include and --exclude, it is excluded. There is no short |
--include and --exclude, it is excluded. There is no short |
| 242 |
form for this option. |
form for this option. |
| 243 |
|
|
| 244 |
-L, --files-without-match |
-L, --files-without-match |
| 245 |
Instead of outputting lines from the files, just output the |
Instead of outputting lines from the files, just output the |
| 246 |
names of the files that do not contain any lines that would |
names of the files that do not contain any lines that would |
| 247 |
have been output. Each file name is output once, on a sepa- |
have been output. Each file name is output once, on a sepa- |
| 248 |
rate line. |
rate line. |
| 249 |
|
|
| 250 |
-l, --files-with-matches |
-l, --files-with-matches |
| 251 |
Instead of outputting lines from the files, just output the |
Instead of outputting lines from the files, just output the |
| 252 |
names of the files containing lines that would have been out- |
names of the files containing lines that would have been out- |
| 253 |
put. Each file name is output once, on a separate line. |
put. Each file name is output once, on a separate line. |
| 254 |
Searching stops as soon as a matching line is found in a |
Searching stops as soon as a matching line is found in a |
| 255 |
file. |
file. |
| 256 |
|
|
| 257 |
--label=name |
--label=name |
| 259 |
when file names are being output. If not supplied, "(standard |
when file names are being output. If not supplied, "(standard |
| 260 |
input)" is used. There is no short form for this option. |
input)" is used. There is no short form for this option. |
| 261 |
|
|
| 262 |
|
--line-offsets |
| 263 |
|
Instead of showing lines or parts of lines that match, show |
| 264 |
|
each match as a line number, the offset from the start of the |
| 265 |
|
line, and a length. The line number is terminated by a colon |
| 266 |
|
(as usual; see the -n option), and the offset and length are |
| 267 |
|
separated by a comma. In this mode, no context is shown. |
| 268 |
|
That is, the -A, -B, and -C options are ignored. If there is |
| 269 |
|
more than one match in a line, each of them is shown sepa- |
| 270 |
|
rately. This option is mutually exclusive with --file-offsets |
| 271 |
|
and --only-matching. |
| 272 |
|
|
| 273 |
--locale=locale-name |
--locale=locale-name |
| 274 |
This option specifies a locale to be used for pattern match- |
This option specifies a locale to be used for pattern match- |
| 275 |
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- |
| 276 |
ronment variables. If no locale is specified, the PCRE |
ronment variables. If no locale is specified, the PCRE |
| 277 |
library's default (usually the "C" locale) is used. There is |
library's default (usually the "C" locale) is used. There is |
| 278 |
no short form for this option. |
no short form for this option. |
| 279 |
|
|
| 280 |
-M, --multiline |
-M, --multiline |
| 281 |
Allow patterns to match more than one line. When this option |
Allow patterns to match more than one line. When this option |
| 282 |
is given, patterns may usefully contain literal newline char- |
is given, patterns may usefully contain literal newline char- |
| 283 |
acters and internal occurrences of ^ and $ characters. The |
acters and internal occurrences of ^ and $ characters. The |
| 284 |
output for any one match may consist of more than one line. |
output for any one match may consist of more than one line. |
| 285 |
When this option is set, the PCRE library is called in "mul- |
When this option is set, the PCRE library is called in "mul- |
| 286 |
tiline" mode. There is a limit to the number of lines that |
tiline" mode. There is a limit to the number of lines that |
| 287 |
can be matched, imposed by the way that pcregrep buffers the |
can be matched, imposed by the way that pcregrep buffers the |
| 288 |
input file as it scans it. However, pcregrep ensures that at |
input file as it scans it. However, pcregrep ensures that at |
| 289 |
least 8K characters or the rest of the document (whichever is |
least 8K characters or the rest of the document (whichever is |
| 290 |
the shorter) are available for forward matching, and simi- |
the shorter) are available for forward matching, and simi- |
| 291 |
larly the previous 8K characters (or all the previous charac- |
larly the previous 8K characters (or all the previous charac- |
| 292 |
ters, if fewer than 8K) are guaranteed to be available for |
ters, if fewer than 8K) are guaranteed to be available for |
| 293 |
lookbehind assertions. |
lookbehind assertions. |
| 294 |
|
|
| 295 |
-N newline-type, --newline=newline-type |
-N newline-type, --newline=newline-type |
| 296 |
The PCRE library supports five different conventions for |
The PCRE library supports five different conventions for |
| 297 |
indicating the ends of lines. They are the single-character |
indicating the ends of lines. They are the single-character |
| 298 |
sequences CR (carriage return) and LF (linefeed), the two- |
sequences CR (carriage return) and LF (linefeed), the two- |
| 299 |
character sequence CRLF, an "anycrlf" convention, which rec- |
character sequence CRLF, an "anycrlf" convention, which rec- |
| 300 |
ognizes any of the preceding three types, and an "any" con- |
ognizes any of the preceding three types, and an "any" con- |
| 301 |
vention, in which any Unicode line ending sequence is assumed |
vention, in which any Unicode line ending sequence is assumed |
| 302 |
to end a line. The Unicode sequences are the three just men- |
to end a line. The Unicode sequences are the three just men- |
| 303 |
tioned, plus VT (vertical tab, U+000B), FF (formfeed, |
tioned, plus VT (vertical tab, U+000B), FF (formfeed, |
| 304 |
U+000C), NEL (next line, U+0085), LS (line separator, |
U+000C), NEL (next line, U+0085), LS (line separator, |
| 305 |
U+2028), and PS (paragraph separator, U+2029). |
U+2028), and PS (paragraph separator, U+2029). |
| 306 |
|
|
| 307 |
When the PCRE library is built, a default line-ending |
When the PCRE library is built, a default line-ending |
| 308 |
sequence is specified. This is normally the standard |
sequence is specified. This is normally the standard |
| 309 |
sequence for the operating system. Unless otherwise specified |
sequence for the operating system. Unless otherwise specified |
| 310 |
by this option, pcregrep uses the library's default. The |
by this option, pcregrep uses the library's default. The |
| 311 |
possible values for this option are CR, LF, CRLF, ANYCRLF, or |
possible values for this option are CR, LF, CRLF, ANYCRLF, or |
| 312 |
ANY. This makes it possible to use pcregrep on files that |
ANY. This makes it possible to use pcregrep on files that |
| 313 |
have come from other environments without having to modify |
have come from other environments without having to modify |
| 314 |
their line endings. If the data that is being scanned does |
their line endings. If the data that is being scanned does |
| 315 |
not agree with the convention set by this option, pcregrep |
not agree with the convention set by this option, pcregrep |
| 316 |
may behave in strange ways. |
may behave in strange ways. |
| 317 |
|
|
| 318 |
-n, --line-number |
-n, --line-number |
| 319 |
Precede each output line by its line number in the file, fol- |
Precede each output line by its line number in the file, fol- |
| 320 |
lowed by a colon and a space for matching lines or a hyphen |
lowed by a colon and a space for matching lines or a hyphen |
| 321 |
and a space for context lines. If the filename is also being |
and a space for context lines. If the filename is also being |
| 322 |
output, it precedes the line number. |
output, it precedes the line number. This option is forced if |
| 323 |
|
--line-offsets is used. |
| 324 |
|
|
| 325 |
-o, --only-matching |
-o, --only-matching |
| 326 |
Show only the part of the line that matched a pattern. In |
Show only the part of the line that matched a pattern. In |
| 327 |
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 |
| 328 |
options are ignored. |
options are ignored. If there is more than one match in a |
| 329 |
|
line, each of them is shown separately. If -o is combined |
| 330 |
|
with -v (invert the sense of the match to find non-matching |
| 331 |
|
lines), no output is generated, but the return code is set |
| 332 |
|
appropriately. This option is mutually exclusive with --file- |
| 333 |
|
offsets and --line-offsets. |
| 334 |
|
|
| 335 |
-q, --quiet |
-q, --quiet |
| 336 |
Work quietly, that is, display nothing except error messages. |
Work quietly, that is, display nothing except error messages. |
| 337 |
The exit status indicates whether or not any matches were |
The exit status indicates whether or not any matches were |
| 338 |
found. |
found. |
| 339 |
|
|
| 340 |
-r, --recursive |
-r, --recursive |
| 341 |
If any given path is a directory, recursively scan the files |
If any given path is a directory, recursively scan the files |
| 342 |
it contains, taking note of any --include and --exclude set- |
it contains, taking note of any --include and --exclude set- |
| 343 |
tings. By default, a directory is read as a normal file; in |
tings. By default, a directory is read as a normal file; in |
| 344 |
some operating systems this gives an immediate end-of-file. |
some operating systems this gives an immediate end-of-file. |
| 345 |
This option is a shorthand for setting the -d option to |
This option is a shorthand for setting the -d option to |
| 346 |
"recurse". |
"recurse". |
| 347 |
|
|
| 348 |
-s, --no-messages |
-s, --no-messages |
| 349 |
Suppress error messages about non-existent or unreadable |
Suppress error messages about non-existent or unreadable |
| 350 |
files. Such files are quietly skipped. However, the return |
files. Such files are quietly skipped. However, the return |
| 351 |
code is still 2, even if matches were found in other files. |
code is still 2, even if matches were found in other files. |
| 352 |
|
|
| 353 |
-u, --utf-8 |
-u, --utf-8 |
| 354 |
Operate in UTF-8 mode. This option is available only if PCRE |
Operate in UTF-8 mode. This option is available only if PCRE |
| 355 |
has been compiled with UTF-8 support. Both patterns and sub- |
has been compiled with UTF-8 support. Both patterns and sub- |
| 356 |
ject lines must be valid strings of UTF-8 characters. |
ject lines must be valid strings of UTF-8 characters. |
| 357 |
|
|
| 358 |
-V, --version |
-V, --version |
| 359 |
Write the version numbers of pcregrep and the PCRE library |
Write the version numbers of pcregrep and the PCRE library |
| 360 |
that is being used to the standard error stream. |
that is being used to the standard error stream. |
| 361 |
|
|
| 362 |
-v, --invert-match |
-v, --invert-match |
| 363 |
Invert the sense of the match, so that lines which do not |
Invert the sense of the match, so that lines which do not |
| 364 |
match any of the patterns are the ones that are found. |
match any of the patterns are the ones that are found. |
| 365 |
|
|
| 366 |
-w, --word-regex, --word-regexp |
-w, --word-regex, --word-regexp |
| 368 |
lent to having \b at the start and end of the pattern. |
lent to having \b at the start and end of the pattern. |
| 369 |
|
|
| 370 |
-x, --line-regex, --line-regexp |
-x, --line-regex, --line-regexp |
| 371 |
Force the patterns to be anchored (each must start matching |
Force the patterns to be anchored (each must start matching |
| 372 |
at the beginning of a line) and in addition, require them to |
at the beginning of a line) and in addition, require them to |
| 373 |
match entire lines. This is equivalent to having ^ and $ |
match entire lines. This is equivalent to having ^ and $ |
| 374 |
characters at the start and end of each alternative branch in |
characters at the start and end of each alternative branch in |
| 375 |
every pattern. |
every pattern. |
| 376 |
|
|
| 377 |
|
|
| 378 |
ENVIRONMENT VARIABLES |
ENVIRONMENT VARIABLES |
| 379 |
|
|
| 380 |
The environment variables LC_ALL and LC_CTYPE are examined, in that |
The environment variables LC_ALL and LC_CTYPE are examined, in that |
| 381 |
order, for a locale. The first one that is set is used. This can be |
order, for a locale. The first one that is set is used. This can be |
| 382 |
overridden by the --locale option. If no locale is set, the PCRE |
overridden by the --locale option. If no locale is set, the PCRE |
| 383 |
library's default (usually the "C" locale) is used. |
library's default (usually the "C" locale) is used. |
| 384 |
|
|
| 385 |
|
|
| 386 |
NEWLINES |
NEWLINES |
| 387 |
|
|
| 388 |
The -N (--newline) option allows pcregrep to scan files with different |
The -N (--newline) option allows pcregrep to scan files with different |
| 389 |
newline conventions from the default. However, the setting of this |
newline conventions from the default. However, the setting of this |
| 390 |
option does not affect the way in which pcregrep writes information to |
option does not affect the way in which pcregrep writes information to |
| 391 |
the standard error and output streams. It uses the string "\n" in C |
the standard error and output streams. It uses the string "\n" in C |
| 392 |
printf() calls to indicate newlines, relying on the C I/O library to |
printf() calls to indicate newlines, relying on the C I/O library to |
| 393 |
convert this to an appropriate sequence if the output is sent to a |
convert this to an appropriate sequence if the output is sent to a |
| 394 |
file. |
file. |
| 395 |
|
|
| 396 |
|
|
| 397 |
OPTIONS COMPATIBILITY |
OPTIONS COMPATIBILITY |
| 398 |
|
|
| 399 |
The majority of short and long forms of pcregrep's options are the same |
The majority of short and long forms of pcregrep's options are the same |
| 400 |
as in the GNU grep program. Any long option of the form --xxx-regexp |
as in the GNU grep program. Any long option of the form --xxx-regexp |
| 401 |
(GNU terminology) is also available as --xxx-regex (PCRE terminology). |
(GNU terminology) is also available as --xxx-regex (PCRE terminology). |
| 402 |
However, the --locale, -M, --multiline, -u, and --utf-8 options are |
However, the --locale, -M, --multiline, -u, and --utf-8 options are |
| 403 |
specific to pcregrep. |
specific to pcregrep. |
| 404 |
|
|
| 405 |
|
|
| 406 |
OPTIONS WITH DATA |
OPTIONS WITH DATA |
| 407 |
|
|
| 408 |
There are four different ways in which an option with data can be spec- |
There are four different ways in which an option with data can be spec- |
| 409 |
ified. If a short form option is used, the data may follow immedi- |
ified. If a short form option is used, the data may follow immedi- |
| 410 |
ately, or in the next command line item. For example: |
ately, or in the next command line item. For example: |
| 411 |
|
|
| 412 |
-f/some/file |
-f/some/file |
| 413 |
-f /some/file |
-f /some/file |
| 414 |
|
|
| 415 |
If a long form option is used, the data may appear in the same command |
If a long form option is used, the data may appear in the same command |
| 416 |
line item, separated by an equals character, or (with one exception) it |
line item, separated by an equals character, or (with one exception) it |
| 417 |
may appear in the next command line item. For example: |
may appear in the next command line item. For example: |
| 418 |
|
|
| 419 |
--file=/some/file |
--file=/some/file |
| 420 |
--file /some/file |
--file /some/file |
| 421 |
|
|
| 422 |
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 ~ |
| 423 |
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 |
| 424 |
directory, you must separate the file name from the option, because the |
directory, you must separate the file name from the option, because the |
| 425 |
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. |
| 426 |
|
|
| 427 |
The exception to the above is the --colour (or --color) option, for |
The exception to the above is the --colour (or --color) option, for |
| 428 |
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 |
| 429 |
given in the first form, using an equals character. Otherwise it will |
given in the first form, using an equals character. Otherwise it will |
| 430 |
be assumed that it has no data. |
be assumed that it has no data. |
| 431 |
|
|
| 432 |
|
|
| 433 |
MATCHING ERRORS |
MATCHING ERRORS |
| 434 |
|
|
| 435 |
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 |
| 436 |
time to fail to match certain lines. Such patterns normally involve |
time to fail to match certain lines. Such patterns normally involve |
| 437 |
nested indefinite repeats, for example: (a+)*\d when matched against a |
nested indefinite repeats, for example: (a+)*\d when matched against a |
| 438 |
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 |
| 439 |
resource limit that causes it to abort in these circumstances. If this |
resource limit that causes it to abort in these circumstances. If this |
| 440 |
happens, pcregrep outputs an error message and the line that caused the |
happens, pcregrep outputs an error message and the line that caused the |
| 441 |
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 |
| 442 |
errors, pcregrep gives up. |
errors, pcregrep gives up. |
| 443 |
|
|
| 444 |
|
|
| 445 |
DIAGNOSTICS |
DIAGNOSTICS |
| 446 |
|
|
| 447 |
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, |
| 448 |
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 |
| 449 |
matches were found in other files) or too many matching errors. Using |
matches were found in other files) or too many matching errors. Using |
| 450 |
the -s option to suppress error messages about inaccessble files does |
the -s option to suppress error messages about inaccessble files does |
| 451 |
not affect the return code. |
not affect the return code. |
| 452 |
|
|
| 453 |
|
|
| 465 |
|
|
| 466 |
REVISION |
REVISION |
| 467 |
|
|
| 468 |
Last updated: 16 April 2007 |
Last updated: 17 December 2007 |
| 469 |
Copyright (c) 1997-2007 University of Cambridge. |
Copyright (c) 1997-2007 University of Cambridge. |