/[pcre]/code/trunk/doc/pcregrep.1
ViewVC logotype

Diff of /code/trunk/doc/pcregrep.1

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 87 by nigel, Sat Feb 24 21:41:21 2007 UTC revision 150 by ph10, Tue Apr 17 08:22:40 2007 UTC
# Line 11  pcregrep - a grep with Perl-compatible r Line 11  pcregrep - a grep with Perl-compatible r
11  grep commands do, but it uses the PCRE regular expression library to support  grep commands do, but it uses the PCRE regular expression library to support
12  patterns that are compatible with the regular expressions of Perl 5. See  patterns that are compatible with the regular expressions of Perl 5. See
13  .\" HREF  .\" HREF
14  \fBpcrepattern\fP  \fBpcrepattern\fP(3)
15  .\"  .\"
16  for a full description of syntax and semantics of the regular expressions that  for a full description of syntax and semantics of the regular expressions
17  PCRE supports.  that PCRE supports.
18  .P  .P
19  Patterns, whether supplied on the command line or in a separate file, are given  Patterns, whether supplied on the command line or in a separate file, are given
20  without delimiters. For example:  without delimiters. For example:
# Line 43  By default, each line that matches the p Line 43  By default, each line that matches the p
43  output, and if there is more than one file, the file name is output at the  output, and if there is more than one file, the file name is output at the
44  start of each line. However, there are options that can change how  start of each line. However, there are options that can change how
45  \fBpcregrep\fP behaves. In particular, the \fB-M\fP option makes it possible to  \fBpcregrep\fP behaves. In particular, the \fB-M\fP option makes it possible to
46  search for patterns that span line boundaries.  search for patterns that span line boundaries. What defines a line boundary is
47    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.  Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
50  BUFSIZ is defined in \fB<stdio.h>\fP.  BUFSIZ is defined in \fB<stdio.h>\fP.
# Line 218  that \fBpcregrep\fP buffers the input fi Line 219  that \fBpcregrep\fP buffers the input fi
219  the previous 8K characters (or all the previous characters, if fewer than 8K)  the previous 8K characters (or all the previous characters, if fewer than 8K)
220  are guaranteed to be available for lookbehind assertions.  are guaranteed to be available for lookbehind assertions.
221  .TP  .TP
222    \fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP
223    The PCRE library supports five different conventions for indicating
224    the ends of lines. They are the single-character sequences CR (carriage return)
225    and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
226    which recognizes any of the preceding three types, and an "any" convention, in
227    which any Unicode line ending sequence is assumed to end a line. The Unicode
228    sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
229    (formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
230    PS (paragraph separator, U+2029).
231    .sp
232    When the PCRE library is built, a default line-ending sequence is specified.
233    This is normally the standard sequence for the operating system. Unless
234    otherwise specified by this option, \fBpcregrep\fP uses the library's default.
235    The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This
236    makes it possible to use \fBpcregrep\fP on files that have come from other
237    environments without having to modify their line endings. If the data that is
238    being scanned does not agree with the convention set by this option,
239    \fBpcregrep\fP may behave in strange ways.
240    .TP
241  \fB-n\fP, \fB--line-number\fP  \fB-n\fP, \fB--line-number\fP
242  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
243  and a space for matching lines or a hyphen and a space for context lines. If  and a space for matching lines or a hyphen and a space for context lines. If
# Line 261  the patterns are the ones that are found Line 281  the patterns are the ones that are found
281  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
282  at the start and end of the pattern.  at the start and end of the pattern.
283  .TP  .TP
284  \fB-x\fP, \fB--line-regex\fP, \fP--line-regexp\fP  \fB-x\fP, \fB--line-regex\fP, \fB--line-regexp\fP
285  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
286  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
287  equivalent to having ^ and $ characters at the start and end of each  equivalent to having ^ and $ characters at the start and end of each
# Line 277  by the \fB--locale\fP option. If no loca Line 297  by the \fB--locale\fP option. If no loca
297  (usually the "C" locale) is used.  (usually the "C" locale) is used.
298  .  .
299  .  .
300    .SH "NEWLINES"
301    .rs
302    .sp
303    The \fB-N\fP (\fB--newline\fP) option allows \fBpcregrep\fP to scan files with
304    different newline conventions from the default. However, the setting of this
305    option does not affect the way in which \fBpcregrep\fP writes information to
306    the standard error and output streams. It uses the string "\en" in C
307    \fBprintf()\fP calls to indicate newlines, relying on the C I/O library to
308    convert this to an appropriate sequence if the output is sent to a file.
309    .
310    .
311  .SH "OPTIONS COMPATIBILITY"  .SH "OPTIONS COMPATIBILITY"
312  .rs  .rs
313  .sp  .sp
# Line 315  in the first form, using an equals chara Line 346  in the first form, using an equals chara
346  it has no data.  it has no data.
347  .  .
348  .  .
349  .SH MATCHING ERRORS  .SH "MATCHING ERRORS"
350  .rs  .rs
351  .sp  .sp
352  It is possible to supply a regular expression that takes a very long time to  It is possible to supply a regular expression that takes a very long time to
# Line 337  suppress error messages about inaccessbl Line 368  suppress error messages about inaccessbl
368  code.  code.
369  .  .
370  .  .
371    .SH "SEE ALSO"
372    .rs
373    .sp
374    \fBpcrepattern\fP(3), \fBpcretest\fP(1).
375    .
376    .
377  .SH AUTHOR  .SH AUTHOR
378  .rs  .rs
379  .sp  .sp
380    .nf
381  Philip Hazel  Philip Hazel
 .br  
382  University Computing Service  University Computing Service
383  .br  Cambridge CB2 3QH, England.
384  Cambridge CB2 3QG, England.  .fi
385  .P  .
386  .in 0  .
387  Last updated: 23 January 2006  .SH REVISION
388  .br  .rs
389  Copyright (c) 1997-2006 University of Cambridge.  .sp
390    .nf
391    Last updated: 16 April 2007
392    Copyright (c) 1997-2007 University of Cambridge.
393    .fi

Legend:
Removed from v.87  
changed lines
  Added in v.150

  ViewVC Help
Powered by ViewVC 1.1.5