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

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

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 17  man page, in case the conversion went wr Line 17  man page, in case the conversion went wr
17  <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>  <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
18  <li><a name="TOC3" href="#SEC3">OPTIONS</a>  <li><a name="TOC3" href="#SEC3">OPTIONS</a>
19  <li><a name="TOC4" href="#SEC4">ENVIRONMENT VARIABLES</a>  <li><a name="TOC4" href="#SEC4">ENVIRONMENT VARIABLES</a>
20  <li><a name="TOC5" href="#SEC5">OPTIONS COMPATIBILITY</a>  <li><a name="TOC5" href="#SEC5">NEWLINES</a>
21  <li><a name="TOC6" href="#SEC6">OPTIONS WITH DATA</a>  <li><a name="TOC6" href="#SEC6">OPTIONS COMPATIBILITY</a>
22  <li><a name="TOC7" href="#SEC7">MATCHING ERRORS</a>  <li><a name="TOC7" href="#SEC7">OPTIONS WITH DATA</a>
23  <li><a name="TOC8" href="#SEC8">DIAGNOSTICS</a>  <li><a name="TOC8" href="#SEC8">MATCHING ERRORS</a>
24  <li><a name="TOC9" href="#SEC9">AUTHOR</a>  <li><a name="TOC9" href="#SEC9">DIAGNOSTICS</a>
25    <li><a name="TOC10" href="#SEC10">SEE ALSO</a>
26    <li><a name="TOC11" href="#SEC11">AUTHOR</a>
27    <li><a name="TOC12" href="#SEC12">REVISION</a>
28  </ul>  </ul>
29  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
30  <P>  <P>
# Line 32  man page, in case the conversion went wr Line 35  man page, in case the conversion went wr
35  <b>pcregrep</b> searches files for character patterns, in the same way as other  <b>pcregrep</b> searches files for character patterns, in the same way as other
36  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
37  patterns that are compatible with the regular expressions of Perl 5. See  patterns that are compatible with the regular expressions of Perl 5. See
38  <a href="pcrepattern.html"><b>pcrepattern</b></a>  <a href="pcrepattern.html"><b>pcrepattern</b>(3)</a>
39  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
40  PCRE supports.  that PCRE supports.
41  </P>  </P>
42  <P>  <P>
43  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
# Line 66  By default, each line that matches the p Line 69  By default, each line that matches the p
69  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
70  start of each line. However, there are options that can change how  start of each line. However, there are options that can change how
71  <b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it possible to  <b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it possible to
72  search for patterns that span line boundaries.  search for patterns that span line boundaries. What defines a line boundary is
73    controlled by the <b>-N</b> (<b>--newline</b>) option.
74  </P>  </P>
75  <P>  <P>
76  Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.  Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
# Line 265  the previous 8K characters (or all the p Line 269  the previous 8K characters (or all the p
269  are guaranteed to be available for lookbehind assertions.  are guaranteed to be available for lookbehind assertions.
270  </P>  </P>
271  <P>  <P>
272    <b>-N</b> <i>newline-type</i>, <b>--newline=</b><i>newline-type</i>
273    The PCRE library supports five different conventions for indicating
274    the ends of lines. They are the single-character sequences CR (carriage return)
275    and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
276    which recognizes any of the preceding three types, and an "any" convention, in
277    which any Unicode line ending sequence is assumed to end a line. The Unicode
278    sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
279    (formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
280    PS (paragraph separator, U+2029).
281    <br>
282    <br>
283    When the PCRE library is built, a default line-ending sequence is specified.
284    This is normally the standard sequence for the operating system. Unless
285    otherwise specified by this option, <b>pcregrep</b> uses the library's default.
286    The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This
287    makes it possible to use <b>pcregrep</b> on files that have come from other
288    environments without having to modify their line endings. If the data that is
289    being scanned does not agree with the convention set by this option,
290    <b>pcregrep</b> may behave in strange ways.
291    </P>
292    <P>
293  <b>-n</b>, <b>--line-number</b>  <b>-n</b>, <b>--line-number</b>
294  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
295  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 317  Force the patterns to match only whole w Line 342  Force the patterns to match only whole w
342  at the start and end of the pattern.  at the start and end of the pattern.
343  </P>  </P>
344  <P>  <P>
345  <b>-x</b>, <b>--line-regex</b>, \fP--line-regexp\fP  <b>-x</b>, <b>--line-regex</b>, <b>--line-regexp</b>
346  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
347  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
348  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 330  order, for a locale. The first one that Line 355  order, for a locale. The first one that
355  by the <b>--locale</b> option. If no locale is set, the PCRE library's default  by the <b>--locale</b> option. If no locale is set, the PCRE library's default
356  (usually the "C" locale) is used.  (usually the "C" locale) is used.
357  </P>  </P>
358  <br><a name="SEC5" href="#TOC1">OPTIONS COMPATIBILITY</a><br>  <br><a name="SEC5" href="#TOC1">NEWLINES</a><br>
359    <P>
360    The <b>-N</b> (<b>--newline</b>) option allows <b>pcregrep</b> to scan files with
361    different newline conventions from the default. However, the setting of this
362    option does not affect the way in which <b>pcregrep</b> writes information to
363    the standard error and output streams. It uses the string "\n" in C
364    <b>printf()</b> calls to indicate newlines, relying on the C I/O library to
365    convert this to an appropriate sequence if the output is sent to a file.
366    </P>
367    <br><a name="SEC6" href="#TOC1">OPTIONS COMPATIBILITY</a><br>
368  <P>  <P>
369  The majority of short and long forms of <b>pcregrep</b>'s options are the same  The majority of short and long forms of <b>pcregrep</b>'s options are the same
370  as in the GNU <b>grep</b> program. Any long option of the form  as in the GNU <b>grep</b> program. Any long option of the form
# Line 338  as in the GNU grep program. Any l Line 372  as in the GNU grep program. Any l
372  (PCRE terminology). However, the <b>--locale</b>, <b>-M</b>, <b>--multiline</b>,  (PCRE terminology). However, the <b>--locale</b>, <b>-M</b>, <b>--multiline</b>,
373  <b>-u</b>, and <b>--utf-8</b> options are specific to <b>pcregrep</b>.  <b>-u</b>, and <b>--utf-8</b> options are specific to <b>pcregrep</b>.
374  </P>  </P>
375  <br><a name="SEC6" href="#TOC1">OPTIONS WITH DATA</a><br>  <br><a name="SEC7" href="#TOC1">OPTIONS WITH DATA</a><br>
376  <P>  <P>
377  There are four different ways in which an option with data can be specified.  There are four different ways in which an option with data can be specified.
378  If a short form option is used, the data may follow immediately, or in the next  If a short form option is used, the data may follow immediately, or in the next
# Line 365  for which the data is optional. If this Line 399  for which the data is optional. If this
399  in the first form, using an equals character. Otherwise it will be assumed that  in the first form, using an equals character. Otherwise it will be assumed that
400  it has no data.  it has no data.
401  </P>  </P>
402  <br><a name="SEC7" href="#TOC1">MATCHING ERRORS</a><br>  <br><a name="SEC8" href="#TOC1">MATCHING ERRORS</a><br>
403  <P>  <P>
404  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
405  fail to match certain lines. Such patterns normally involve nested indefinite  fail to match certain lines. Such patterns normally involve nested indefinite
# Line 375  in these circumstances. If this happens, Line 409  in these circumstances. If this happens,
409  message and the line that caused the problem to the standard error stream. If  message and the line that caused the problem to the standard error stream. If
410  there are more than 20 such errors, <b>pcregrep</b> gives up.  there are more than 20 such errors, <b>pcregrep</b> gives up.
411  </P>  </P>
412  <br><a name="SEC8" href="#TOC1">DIAGNOSTICS</a><br>  <br><a name="SEC9" href="#TOC1">DIAGNOSTICS</a><br>
413  <P>  <P>
414  Exit status is 0 if any matches were found, 1 if no matches were found, and 2  Exit status is 0 if any matches were found, 1 if no matches were found, and 2
415  for syntax errors and non-existent or inacessible files (even if matches were  for syntax errors and non-existent or inacessible files (even if matches were
# Line 383  found in other files) or too many matchi Line 417  found in other files) or too many matchi
417  suppress error messages about inaccessble files does not affect the return  suppress error messages about inaccessble files does not affect the return
418  code.  code.
419  </P>  </P>
420  <br><a name="SEC9" href="#TOC1">AUTHOR</a><br>  <br><a name="SEC10" href="#TOC1">SEE ALSO</a><br>
421    <P>
422    <b>pcrepattern</b>(3), <b>pcretest</b>(1).
423    </P>
424    <br><a name="SEC11" href="#TOC1">AUTHOR</a><br>
425  <P>  <P>
426  Philip Hazel  Philip Hazel
427  <br>  <br>
428  University Computing Service  University Computing Service
429  <br>  <br>
430  Cambridge CB2 3QG, England.  Cambridge CB2 3QH, England.
431    <br>
432  </P>  </P>
433    <br><a name="SEC12" href="#TOC1">REVISION</a><br>
434  <P>  <P>
435  Last updated: 23 January 2006  Last updated: 16 April 2007
436    <br>
437    Copyright &copy; 1997-2007 University of Cambridge.
438  <br>  <br>
 Copyright &copy; 1997-2006 University of Cambridge.  
439  <p>  <p>
440  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.
441  </p>  </p>

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12