| 1 |
.TH PCREGREP 1 "04 March 2012" "PCRE 8.31" |
.TH PCREGREP 1 "15 August 2012" "PCRE 8.32" |
| 2 |
.SH NAME |
.SH NAME |
| 3 |
pcregrep - a grep with Perl-compatible regular expressions. |
pcregrep - a grep with Perl-compatible regular expressions. |
| 4 |
.SH SYNOPSIS |
.SH SYNOPSIS |
| 24 |
If you attempt to use delimiters (for example, by surrounding a pattern with |
If you attempt to use delimiters (for example, by surrounding a pattern with |
| 25 |
slashes, as is common in Perl scripts), they are interpreted as part of the |
slashes, as is common in Perl scripts), they are interpreted as part of the |
| 26 |
pattern. Quotes can of course be used to delimit patterns on the command line |
pattern. Quotes can of course be used to delimit patterns on the command line |
| 27 |
because they are interpreted by the shell, and indeed they are required if a |
because they are interpreted by the shell, and indeed quotes are required if a |
| 28 |
pattern contains white space or shell metacharacters. |
pattern contains white space or shell metacharacters. |
| 29 |
.P |
.P |
| 30 |
The first argument that follows any option settings is treated as the single |
The first argument that follows any option settings is treated as the single |
| 53 |
used (to allow for buffering "before" and "after" lines). An error occurs if a |
used (to allow for buffering "before" and "after" lines). An error occurs if a |
| 54 |
line overflows the buffer. |
line overflows the buffer. |
| 55 |
.P |
.P |
| 56 |
Patterns are limited to 8K or BUFSIZ bytes, whichever is the greater. BUFSIZ is |
Patterns can be no longer than 8K or BUFSIZ bytes, whichever is the greater. |
| 57 |
defined in \fB<stdio.h>\fP. When there is more than one pattern (specified by |
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern |
| 58 |
the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to each line in |
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to |
| 59 |
the order in which they are defined, except that all the \fB-e\fP patterns are |
each line in the order in which they are defined, except that all the \fB-e\fP |
| 60 |
tried before the \fB-f\fP patterns. |
patterns are 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 a line, no further patterns are |
| 63 |
used), no further patterns are considered. However, if \fB--colour\fP (or |
considered. However, if \fB--colour\fP (or \fB--color\fP) is used to colour the |
| 64 |
\fB--color\fP) is used to colour the matching substrings, or if |
matching substrings, or if \fB--only-matching\fP, \fB--file-offsets\fP, or |
| 65 |
\fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP is used to |
\fB--line-offsets\fP is used to output only the part of the line that matched |
| 66 |
output only the part of the line that matched (either shown literally, or as an |
(either shown literally, or as an offset), scanning resumes immediately |
| 67 |
offset), scanning resumes immediately following the match, so that further |
following the match, so that further matches on the same line can be found. If |
| 68 |
matches on the same line can be found. If there are multiple patterns, they are |
there are multiple patterns, they are all tried on the remainder of the line, |
| 69 |
all tried on the remainder of the line, but patterns that follow the one that |
but patterns that follow the one that matched are not tried on the earlier part |
| 70 |
matched are not tried on the earlier part of the line. |
of the line. |
| 71 |
.P |
.P |
| 72 |
This is the same behaviour as GNU grep, but it does mean that the order in |
This behaviour means that the order in which multiple patterns are specified |
| 73 |
which multiple patterns are specified can affect the output when one of the |
can affect the output when one of the above options is used. This is no longer |
| 74 |
above options is used. |
the same behaviour as GNU grep, which now manages to display earlier matches |
| 75 |
|
for later patterns (as long as there is no overlap). |
| 76 |
.P |
.P |
| 77 |
Patterns that can match an empty string are accepted, but empty string |
Patterns that can match an empty string are accepted, but empty string |
| 78 |
matches are never recognized. An example is the pattern "(super)?(man)?", in |
matches are never recognized. An example is the pattern "(super)?(man)?", in |
| 111 |
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 |
| 112 |
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 |
| 113 |
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 |
| 114 |
effect. Numerical values for options may be followed by K or M, to signify |
effect. Similarly, except where noted below, if an option is given twice, the |
| 115 |
multiplication by 1024 or 1024*1024 respectively. |
later setting is used. Numerical values for options may be followed by K or M, |
| 116 |
|
to signify multiplication by 1024 or 1024*1024 respectively. |
| 117 |
.TP 10 |
.TP 10 |
| 118 |
\fB--\fP |
\fB--\fP |
| 119 |
This terminates 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 |
| 196 |
.TP |
.TP |
| 197 |
\fB-d\fP \fIaction\fP, \fB--directories=\fP\fIaction\fP |
\fB-d\fP \fIaction\fP, \fB--directories=\fP\fIaction\fP |
| 198 |
If an input path is a directory, "action" specifies how it is to be processed. |
If an input path is a directory, "action" specifies how it is to be processed. |
| 199 |
Valid values are "read" (the default), "recurse" (equivalent to the \fB-r\fP |
Valid values are "read" (the default in non-Windows environments, for |
| 200 |
option), or "skip" (silently skip the path). In the default case, directories |
compatibility with GNU grep), "recurse" (equivalent to the \fB-r\fP option), or |
| 201 |
are read as if they were ordinary files. In some operating systems the effect |
"skip" (silently skip the path, the default in Windows environments). In the |
| 202 |
of reading a directory like this is an immediate end-of-file. |
"read" case, directories are read as if they were ordinary files. In some |
| 203 |
|
operating systems the effect of reading a directory like this is an immediate |
| 204 |
|
end-of-file; in others it may provoke an error. |
| 205 |
.TP |
.TP |
| 206 |
\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 |
| 207 |
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 |
| 208 |
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 |
| 209 |
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 |
| 210 |
pattern is taken from the command line; all arguments are treated as file |
pattern is taken from the command line; all arguments are treated as file |
| 211 |
names. There is an overall maximum of 100 patterns. They are applied to each |
names. There is no limit to the number of patterns. They are applied to each |
| 212 |
line in the order in which they are defined until one matches (or fails to |
line in the order in which they are defined until one matches. |
| 213 |
match if \fB-v\fP is used). If \fB-f\fP is used with \fB-e\fP, the command line |
.sp |
| 214 |
patterns are matched first, followed by the patterns from the file, independent |
If \fB-f\fP is used with \fB-e\fP, the command line patterns are matched first, |
| 215 |
of the order in which these options are specified. Note that multiple use of |
followed by the patterns from the file(s), independent of the order in which |
| 216 |
\fB-e\fP is not the same as a single pattern with alternatives. For example, |
these options are specified. Note that multiple use of \fB-e\fP is not the same |
| 217 |
X|Y finds the first character in a line that is X or Y, whereas if the two |
as a single pattern with alternatives. For example, X|Y finds the first |
| 218 |
patterns are given separately, \fBpcregrep\fP finds X if it is present, even if |
character in a line that is X or Y, whereas if the two patterns are given |
| 219 |
it follows Y in the line. It finds Y only if there is no X in the line. This |
separately, with X first, \fBpcregrep\fP finds X if it is present, even if it |
| 220 |
really matters only if you are using \fB-o\fP to show the part(s) of the line |
follows Y in the line. It finds Y only if there is no X in the line. This |
| 221 |
that matched. |
matters only if you are using \fB-o\fP or \fB--colo(u)r\fP to show the part(s) |
| 222 |
|
of the line that matched. |
| 223 |
.TP |
.TP |
| 224 |
\fB--exclude\fP=\fIpattern\fP |
\fB--exclude\fP=\fIpattern\fP |
| 225 |
When \fBpcregrep\fP is searching the files in a directory as a consequence of |
Files (but not directories) whose names match the pattern are skipped without |
| 226 |
the \fB-r\fP (recursive search) option, any regular files whose names match the |
being processed. This applies to all files, whether listed on the command line, |
| 227 |
pattern are excluded. Subdirectories are not excluded by this option; they are |
obtained from \fB--file-list\fP, or by scanning a directory. The pattern is a |
| 228 |
searched recursively, subject to the \fB--exclude-dir\fP and |
PCRE regular expression, and is matched against the final component of the file |
| 229 |
\fB--include_dir\fP options. The pattern is a PCRE regular expression, and is |
name, not the entire path. The \fB-F\fP, \fB-w\fP, and \fB-x\fP options do not |
| 230 |
matched against the final component of the file name (not the entire path). If |
apply to this pattern. The option may be given any number of times in order to |
| 231 |
a file name matches both \fB--include\fP and \fB--exclude\fP, it is excluded. |
specify multiple patterns. If a file name matches both an \fB--include\fP |
| 232 |
There is no short form for this option. |
and an \fB--exclude\fP pattern, it is excluded. There is no short form for this |
| 233 |
|
option. |
| 234 |
|
.TP |
| 235 |
|
\fB--exclude-from=\fP\fIfilename\fP |
| 236 |
|
Treat each non-empty line of the file as the data for an \fB--exclude\fP |
| 237 |
|
option. What constitutes a newline when reading the file is the operating |
| 238 |
|
system's default. The \fB--newline\fP option has no effect on this option. This |
| 239 |
|
option may be given more than once in order to specify a number of files to |
| 240 |
|
read. |
| 241 |
.TP |
.TP |
| 242 |
\fB--exclude-dir\fP=\fIpattern\fP |
\fB--exclude-dir\fP=\fIpattern\fP |
| 243 |
When \fBpcregrep\fP is searching the contents of a directory as a consequence |
Directories whose names match the pattern are skipped without being processed, |
| 244 |
of the \fB-r\fP (recursive search) option, any subdirectories whose names match |
whatever the setting of the \fB--recursive\fP option. This applies to all |
| 245 |
the pattern are excluded. (Note that the \fP--exclude\fP option does not affect |
directories, whether listed on the command line, obtained from |
| 246 |
subdirectories.) The pattern is a PCRE regular expression, and is matched |
\fB--file-list\fP, or by scanning a parent directory. The pattern is a PCRE |
| 247 |
against the final component of the name (not the entire path). If a |
regular expression, and is matched against the final component of the directory |
| 248 |
subdirectory name matches both \fB--include-dir\fP and \fB--exclude-dir\fP, it |
name, not the entire path. The \fB-F\fP, \fB-w\fP, and \fB-x\fP options do not |
| 249 |
is excluded. There is no short form for this option. |
apply to this pattern. The option may be given any number of times in order to |
| 250 |
|
specify more than one pattern. If a directory matches both \fB--include-dir\fP |
| 251 |
|
and \fB--exclude-dir\fP, it is excluded. There is no short form for this |
| 252 |
|
option. |
| 253 |
.TP |
.TP |
| 254 |
\fB-F\fP, \fB--fixed-strings\fP |
\fB-F\fP, \fB--fixed-strings\fP |
| 255 |
Interpret each pattern as a list of fixed strings, separated by newlines, |
Interpret each data-matching pattern as a list of fixed strings, separated by |
| 256 |
instead of as a regular expression. The \fB-w\fP (match as a word) and \fB-x\fP |
newlines, instead of as a regular expression. What constitutes a newline for |
| 257 |
(match whole line) options can be used with \fB-F\fP. They apply to each of the |
this purpose is controlled by the \fB--newline\fP option. The \fB-w\fP (match |
| 258 |
fixed strings. A line is selected if any of the fixed strings are found in it |
as a word) and \fB-x\fP (match whole line) options can be used with \fB-F\fP. |
| 259 |
(subject to \fB-w\fP or \fB-x\fP, if present). |
They apply to each of the fixed strings. A line is selected if any of the fixed |
| 260 |
|
strings are found in it (subject to \fB-w\fP or \fB-x\fP, if present). This |
| 261 |
|
option applies only to the patterns that are matched against the contents of |
| 262 |
|
files; it does not apply to patterns specified by any of the \fB--include\fP or |
| 263 |
|
\fB--exclude\fP options. |
| 264 |
.TP |
.TP |
| 265 |
\fB-f\fP \fIfilename\fP, \fB--file=\fP\fIfilename\fP |
\fB-f\fP \fIfilename\fP, \fB--file=\fP\fIfilename\fP |
| 266 |
Read a number of patterns from the file, one per line, and match them against |
Read patterns from the file, one per line, and match them against |
| 267 |
each line of input. A data line is output if any of the patterns match it. The |
each line of input. What constitutes a newline when reading the file is the |
| 268 |
filename can be given as "-" to refer to the standard input. When \fB-f\fP is |
operating system's default. The \fB--newline\fP option has no effect on this |
| 269 |
used, patterns specified on the command line using \fB-e\fP may also be |
option. Trailing white space is removed from each line, and blank lines are |
| 270 |
present; they are tested before the file's patterns. However, no other pattern |
ignored. An empty file contains no patterns and therefore matches nothing. See |
| 271 |
is taken from the command line; all arguments are treated as the names of paths |
also the comments about multiple patterns versus a single pattern with |
| 272 |
to be searched. There is an overall maximum of 100 patterns. Trailing white |
alternatives in the description of \fB-e\fP above. |
| 273 |
space is removed from each line, and blank lines are ignored. An empty file |
.sp |
| 274 |
contains no patterns and therefore matches nothing. See also the comments about |
If this option is given more than once, all the specified files are |
| 275 |
multiple patterns versus a single pattern with alternatives in the description |
read. A data line is output if any of the patterns match it. A filename can |
| 276 |
of \fB-e\fP above. |
be given as "-" to refer to the standard input. When \fB-f\fP is used, patterns |
| 277 |
|
specified on the command line using \fB-e\fP may also be present; they are |
| 278 |
|
tested before the file's patterns. However, no other pattern is taken from the |
| 279 |
|
command line; all arguments are treated as the names of paths to be searched. |
| 280 |
.TP |
.TP |
| 281 |
\fB--file-list\fP=\fIfilename\fP |
\fB--file-list\fP=\fIfilename\fP |
| 282 |
Read a list of files to be searched from the given file, one per line. Trailing |
Read a list of files and/or directories that are to be scanned from the given |
| 283 |
white space is removed from each line, and blank lines are ignored. These files |
file, one per line. Trailing white space is removed from each line, and blank |
| 284 |
are searched before any others that may be listed on the command line. The |
lines are ignored. These paths are processed before any that are listed on the |
| 285 |
filename can be given as "-" to refer to the standard input. If \fB--file\fP |
command line. The filename can be given as "-" to refer to the standard input. |
| 286 |
and \fB--file-list\fP are both specified as "-", patterns are read first. This |
If \fB--file\fP and \fB--file-list\fP are both specified as "-", patterns are |
| 287 |
is useful only when the standard input is a terminal, from which further lines |
read first. This is useful only when the standard input is a terminal, from |
| 288 |
(the list of files) can be read after an end-of-file indication. |
which further lines (the list of files) can be read after an end-of-file |
| 289 |
|
indication. If this option is given more than once, all the specified files are |
| 290 |
|
read. |
| 291 |
.TP |
.TP |
| 292 |
\fB--file-offsets\fP |
\fB--file-offsets\fP |
| 293 |
Instead of showing lines or parts of lines that match, show each match as an |
Instead of showing lines or parts of lines that match, show each match as an |
| 312 |
.TP |
.TP |
| 313 |
\fB--help\fP |
\fB--help\fP |
| 314 |
Output a help message, giving brief details of the command options and file |
Output a help message, giving brief details of the command options and file |
| 315 |
type support, and then exit. |
type support, and then exit. Anything else on the command line is |
| 316 |
|
ignored. |
| 317 |
.TP |
.TP |
| 318 |
\fB-I\fP |
\fB-I\fP |
| 319 |
Treat binary files as never matching. This is equivalent to |
Treat binary files as never matching. This is equivalent to |
| 323 |
Ignore upper/lower case distinctions during comparisons. |
Ignore upper/lower case distinctions during comparisons. |
| 324 |
.TP |
.TP |
| 325 |
\fB--include\fP=\fIpattern\fP |
\fB--include\fP=\fIpattern\fP |
| 326 |
When \fBpcregrep\fP is searching the files in a directory as a consequence of |
If any \fB--include\fP patterns are specified, the only files that are |
| 327 |
the \fB-r\fP (recursive search) option, only those regular files whose names |
processed are those that match one of the patterns (and do not match an |
| 328 |
match the pattern are included. Subdirectories are always included and searched |
\fB--exclude\fP pattern). This option does not affect directories, but it |
| 329 |
recursively, subject to the \fP--include-dir\fP and \fB--exclude-dir\fP |
applies to all files, whether listed on the command line, obtained from |
| 330 |
options. The pattern is a PCRE regular expression, and is matched against the |
\fB--file-list\fP, or by scanning a directory. The pattern is a PCRE regular |
| 331 |
final component of the file name (not the entire path). If a file name matches |
expression, and is matched against the final component of the file name, not |
| 332 |
both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short |
the entire path. The \fB-F\fP, \fB-w\fP, and \fB-x\fP options do not apply to |
| 333 |
form for this option. |
this pattern. The option may be given any number of times. If a file name |
| 334 |
|
matches both an \fB--include\fP and an \fB--exclude\fP pattern, it is excluded. |
| 335 |
|
There is no short form for this option. |
| 336 |
|
.TP |
| 337 |
|
\fB--include-from=\fP\fIfilename\fP |
| 338 |
|
Treat each non-empty line of the file as the data for an \fB--include\fP |
| 339 |
|
option. What constitutes a newline for this purpose is the operating system's |
| 340 |
|
default. The \fB--newline\fP option has no effect on this option. This option |
| 341 |
|
may be given any number of times; all the files are read. |
| 342 |
.TP |
.TP |
| 343 |
\fB--include-dir\fP=\fIpattern\fP |
\fB--include-dir\fP=\fIpattern\fP |
| 344 |
When \fBpcregrep\fP is searching the contents of a directory as a consequence |
If any \fB--include-dir\fP patterns are specified, the only directories that |
| 345 |
of the \fB-r\fP (recursive search) option, only those subdirectories whose |
are processed are those that match one of the patterns (and do not match an |
| 346 |
names match the pattern are included. (Note that the \fB--include\fP option |
\fB--exclude-dir\fP pattern). This applies to all directories, whether listed |
| 347 |
does not affect subdirectories.) The pattern is a PCRE regular expression, and |
on the command line, obtained from \fB--file-list\fP, or by scanning a parent |
| 348 |
is matched against the final component of the name (not the entire path). If a |
directory. The pattern is a PCRE regular expression, and is matched against the |
| 349 |
subdirectory name matches both \fB--include-dir\fP and \fB--exclude-dir\fP, it |
final component of the directory name, not the entire path. The \fB-F\fP, |
| 350 |
is excluded. There is no short form for this option. |
\fB-w\fP, and \fB-x\fP options do not apply to this pattern. The option may be |
| 351 |
|
given any number of times. If a directory matches both \fB--include-dir\fP and |
| 352 |
|
\fB--exclude-dir\fP, it is excluded. There is no short form for this option. |
| 353 |
.TP |
.TP |
| 354 |
\fB-L\fP, \fB--files-without-match\fP |
\fB-L\fP, \fB--files-without-match\fP |
| 355 |
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 |
| 374 |
When this option is given, input is read and processed line by line, and the |
When this option is given, input is read and processed line by line, and the |
| 375 |
output is flushed after each write. By default, input is read in large chunks, |
output is flushed after each write. By default, input is read in large chunks, |
| 376 |
unless \fBpcregrep\fP can determine that it is reading from a terminal (which |
unless \fBpcregrep\fP can determine that it is reading from a terminal (which |
| 377 |
is currently possible only in Unix environments). Output to terminal is |
is currently possible only in Unix-like environments). Output to terminal is |
| 378 |
normally automatically flushed by the operating system. This option can be |
normally automatically flushed by the operating system. This option can be |
| 379 |
useful when the input or output is attached to a pipe and you do not want |
useful when the input or output is attached to a pipe and you do not want |
| 380 |
\fBpcregrep\fP to buffer up large amounts of data. However, its use will affect |
\fBpcregrep\fP to buffer up large amounts of data. However, its use will affect |
| 451 |
This is normally the standard sequence for the operating system. Unless |
This is normally the standard sequence for the operating system. Unless |
| 452 |
otherwise specified by this option, \fBpcregrep\fP uses the library's default. |
otherwise specified by this option, \fBpcregrep\fP uses the library's default. |
| 453 |
The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This |
The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This |
| 454 |
makes it possible to use \fBpcregrep\fP on files that have come from other |
makes it possible to use \fBpcregrep\fP to scan files that have come from other |
| 455 |
environments without having to modify their line endings. If the data that is |
environments without having to modify their line endings. If the data that is |
| 456 |
being scanned does not agree with the convention set by this option, |
being scanned does not agree with the convention set by this option, |
| 457 |
\fBpcregrep\fP may behave in strange ways. |
\fBpcregrep\fP may behave in strange ways. Note that this option does not |
| 458 |
|
apply to files specified by the \fB-f\fP, \fB--exclude-from\fP, or |
| 459 |
|
\fB--include-from\fP options, which are expected to use the operating system's |
| 460 |
|
standard newline sequence. |
| 461 |
.TP |
.TP |
| 462 |
\fB-n\fP, \fB--line-number\fP |
\fB-n\fP, \fB--line-number\fP |
| 463 |
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 |
| 514 |
.TP |
.TP |
| 515 |
\fB-u\fP, \fB--utf-8\fP |
\fB-u\fP, \fB--utf-8\fP |
| 516 |
Operate in UTF-8 mode. This option is available only if PCRE has been compiled |
Operate in UTF-8 mode. This option is available only if PCRE has been compiled |
| 517 |
with UTF-8 support. Both patterns and subject lines must be valid strings of |
with UTF-8 support. All patterns (including those for any \fB--exclude\fP and |
| 518 |
UTF-8 characters. |
\fB--include\fP options) and all subject lines that are scanned must be valid |
| 519 |
|
strings of UTF-8 characters. |
| 520 |
.TP |
.TP |
| 521 |
\fB-V\fP, \fB--version\fP |
\fB-V\fP, \fB--version\fP |
| 522 |
Write the version numbers of \fBpcregrep\fP and the PCRE library that is being |
Write the version numbers of \fBpcregrep\fP and the PCRE library to the |
| 523 |
used to the standard error stream. |
standard output and then exit. Anything else on the command line is |
| 524 |
|
ignored. |
| 525 |
.TP |
.TP |
| 526 |
\fB-v\fP, \fB--invert-match\fP |
\fB-v\fP, \fB--invert-match\fP |
| 527 |
Invert the sense of the match, so that lines which do \fInot\fP match any of |
Invert the sense of the match, so that lines which do \fInot\fP match any of |
| 529 |
.TP |
.TP |
| 530 |
\fB-w\fP, \fB--word-regex\fP, \fB--word-regexp\fP |
\fB-w\fP, \fB--word-regex\fP, \fB--word-regexp\fP |
| 531 |
Force the patterns to match only whole words. This is equivalent to having \eb |
Force the patterns to match only whole words. This is equivalent to having \eb |
| 532 |
at the start and end of the pattern. |
at the start and end of the pattern. This option applies only to the patterns |
| 533 |
|
that are matched against the contents of files; it does not apply to patterns |
| 534 |
|
specified by any of the \fB--include\fP or \fB--exclude\fP options. |
| 535 |
.TP |
.TP |
| 536 |
\fB-x\fP, \fB--line-regex\fP, \fB--line-regexp\fP |
\fB-x\fP, \fB--line-regex\fP, \fB--line-regexp\fP |
| 537 |
Force the patterns to be anchored (each must start matching at the beginning of |
Force the patterns to be anchored (each must start matching at the beginning of |
| 538 |
a line) and in addition, require them to match entire lines. This is |
a line) and in addition, require them to match entire lines. This is equivalent |
| 539 |
equivalent to having ^ and $ characters at the start and end of each |
to having ^ and $ characters at the start and end of each alternative branch in |
| 540 |
alternative branch in every pattern. |
every pattern. This option applies only to the patterns that are matched |
| 541 |
|
against the contents of files; it does not apply to patterns specified by any |
| 542 |
|
of the \fB--include\fP or \fB--exclude\fP options. |
| 543 |
. |
. |
| 544 |
. |
. |
| 545 |
.SH "ENVIRONMENT VARIABLES" |
.SH "ENVIRONMENT VARIABLES" |
| 555 |
.rs |
.rs |
| 556 |
.sp |
.sp |
| 557 |
The \fB-N\fP (\fB--newline\fP) option allows \fBpcregrep\fP to scan files with |
The \fB-N\fP (\fB--newline\fP) option allows \fBpcregrep\fP to scan files with |
| 558 |
different newline conventions from the default. However, the setting of this |
different newline conventions from the default. Any parts of the input files |
| 559 |
option does not affect the way in which \fBpcregrep\fP writes information to |
that are written to the standard output are copied identically, with whatever |
| 560 |
the standard error and output streams. It uses the string "\en" in C |
newline sequences they have in the input. However, the setting of this option |
| 561 |
\fBprintf()\fP calls to indicate newlines, relying on the C I/O library to |
does not affect the interpretation of files specified by the \fB-f\fP, |
| 562 |
convert this to an appropriate sequence if the output is sent to a file. |
\fB--exclude-from\fP, or \fB--include-from\fP options, which are assumed to use |
| 563 |
|
the operating system's standard newline sequence, nor does it affect the way in |
| 564 |
|
which \fBpcregrep\fP writes informational messages to the standard error and |
| 565 |
|
output streams. For these it uses the string "\en" to indicate newlines, |
| 566 |
|
relying on the C I/O library to convert this to an appropriate sequence. |
| 567 |
. |
. |
| 568 |
. |
. |
| 569 |
.SH "OPTIONS COMPATIBILITY" |
.SH "OPTIONS COMPATIBILITY" |
| 648 |
.SH "SEE ALSO" |
.SH "SEE ALSO" |
| 649 |
.rs |
.rs |
| 650 |
.sp |
.sp |
| 651 |
\fBpcrepattern\fP(3), \fBpcretest\fP(1). |
\fBpcrepattern\fP(3), \fBpcresyntax\fP(3), \fBpcretest\fP(1). |
| 652 |
. |
. |
| 653 |
. |
. |
| 654 |
.SH AUTHOR |
.SH AUTHOR |
| 665 |
.rs |
.rs |
| 666 |
.sp |
.sp |
| 667 |
.nf |
.nf |
| 668 |
Last updated: 04 March 2012 |
Last updated: 15 August 2012 |
| 669 |
Copyright (c) 1997-2012 University of Cambridge. |
Copyright (c) 1997-2012 University of Cambridge. |
| 670 |
.fi |
.fi |