/[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 953 by ph10, Sun Sep 11 14:31:21 2011 UTC revision 954 by ph10, Sat Mar 31 18:09:26 2012 UTC
# Line 16  man page, in case the conversion went wr Line 16  man page, in case the conversion went wr
16  <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>  <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
17  <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>  <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
18  <li><a name="TOC3" href="#SEC3">SUPPORT FOR COMPRESSED FILES</a>  <li><a name="TOC3" href="#SEC3">SUPPORT FOR COMPRESSED FILES</a>
19  <li><a name="TOC4" href="#SEC4">OPTIONS</a>  <li><a name="TOC4" href="#SEC4">BINARY FILES</a>
20  <li><a name="TOC5" href="#SEC5">ENVIRONMENT VARIABLES</a>  <li><a name="TOC5" href="#SEC5">OPTIONS</a>
21  <li><a name="TOC6" href="#SEC6">NEWLINES</a>  <li><a name="TOC6" href="#SEC6">ENVIRONMENT VARIABLES</a>
22  <li><a name="TOC7" href="#SEC7">OPTIONS COMPATIBILITY</a>  <li><a name="TOC7" href="#SEC7">NEWLINES</a>
23  <li><a name="TOC8" href="#SEC8">OPTIONS WITH DATA</a>  <li><a name="TOC8" href="#SEC8">OPTIONS COMPATIBILITY</a>
24  <li><a name="TOC9" href="#SEC9">MATCHING ERRORS</a>  <li><a name="TOC9" href="#SEC9">OPTIONS WITH DATA</a>
25  <li><a name="TOC10" href="#SEC10">DIAGNOSTICS</a>  <li><a name="TOC10" href="#SEC10">MATCHING ERRORS</a>
26  <li><a name="TOC11" href="#SEC11">SEE ALSO</a>  <li><a name="TOC11" href="#SEC11">DIAGNOSTICS</a>
27  <li><a name="TOC12" href="#SEC12">AUTHOR</a>  <li><a name="TOC12" href="#SEC12">SEE ALSO</a>
28  <li><a name="TOC13" href="#SEC13">REVISION</a>  <li><a name="TOC13" href="#SEC13">AUTHOR</a>
29    <li><a name="TOC14" href="#SEC14">REVISION</a>
30  </ul>  </ul>
31  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
32  <P>  <P>
# Line 125  of these file types by running it with t Line 126  of these file types by running it with t
126  appropriate support is not present, files are treated as plain text. The  appropriate support is not present, files are treated as plain text. The
127  standard input is always so treated.  standard input is always so treated.
128  </P>  </P>
129  <br><a name="SEC4" href="#TOC1">OPTIONS</a><br>  <br><a name="SEC4" href="#TOC1">BINARY FILES</a><br>
130    <P>
131    By default, a file that contains a binary zero byte within the first 1024 bytes
132    is identified as a binary file, and is processed specially. (GNU grep also
133    identifies binary files in this manner.) See the <b>--binary-files</b> option
134    for a means of changing the way binary files are handled.
135    </P>
136    <br><a name="SEC5" href="#TOC1">OPTIONS</a><br>
137  <P>  <P>
138  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
139  example, both the <b>-h</b> and <b>-l</b> options affect the printing of file  example, both the <b>-h</b> and <b>-l</b> options affect the printing of file
# Line 149  of <i>number</i> is expected to be relat Line 157  of <i>number</i> is expected to be relat
157  guarantees to have up to 8K of following text available for context output.  guarantees to have up to 8K of following text available for context output.
158  </P>  </P>
159  <P>  <P>
160    <b>-a</b>, <b>--text</b>
161    Treat binary files as text. This is equivalent to
162    <b>--binary-files</b>=<i>text</i>.
163    </P>
164    <P>
165  <b>-B</b> <i>number</i>, <b>--before-context=</b><i>number</i>  <b>-B</b> <i>number</i>, <b>--before-context=</b><i>number</i>
166  Output <i>number</i> lines of context before each matching line. If filenames  Output <i>number</i> lines of context before each matching line. If filenames
167  and/or line numbers are being output, a hyphen separator is used instead of a  and/or line numbers are being output, a hyphen separator is used instead of a
# Line 158  of <i>number</i> is expected to be relat Line 171  of <i>number</i> is expected to be relat
171  guarantees to have up to 8K of preceding text available for context output.  guarantees to have up to 8K of preceding text available for context output.
172  </P>  </P>
173  <P>  <P>
174    <b>--binary-files=</b><i>word</i>
175    Specify how binary files are to be processed. If the word is "binary" (the
176    default), pattern matching is performed on binary files, but the only output is
177    "Binary file &#60;name&#62; matches" when a match succeeds. If the word is "text",
178    which is equivalent to the <b>-a</b> or <b>--text</b> option, binary files are
179    processed in the same way as any other file. In this case, when a match
180    succeeds, the output may be binary garbage, which can have nasty effects if
181    sent to a terminal. If the word is "without-match", which is equivalent to the
182    <b>-I</b> option, binary files are not processed at all; they are assumed not to
183    be of interest.
184    </P>
185    <P>
186  <b>--buffer-size=</b><i>number</i>  <b>--buffer-size=</b><i>number</i>
187  Set the parameter that controls how much memory is used for buffering files  Set the parameter that controls how much memory is used for buffering files
188  that are being scanned.  that are being scanned.
# Line 269  each line of input. A data line is outpu Line 294  each line of input. A data line is outpu
294  filename can be given as "-" to refer to the standard input. When <b>-f</b> is  filename can be given as "-" to refer to the standard input. When <b>-f</b> is
295  used, patterns specified on the command line using <b>-e</b> may also be  used, patterns specified on the command line using <b>-e</b> may also be
296  present; they are tested before the file's patterns. However, no other pattern  present; they are tested before the file's patterns. However, no other pattern
297  is taken from the command line; all arguments are treated as file names. There  is taken from the command line; all arguments are treated as the names of paths
298  is an overall maximum of 100 patterns. Trailing white space is removed from  to be searched. There is an overall maximum of 100 patterns. Trailing white
299  each line, and blank lines are ignored. An empty file contains no patterns and  space is removed from each line, and blank lines are ignored. An empty file
300  therefore matches nothing. See also the comments about multiple patterns versus  contains no patterns and therefore matches nothing. See also the comments about
301  a single pattern with alternatives in the description of <b>-e</b> above.  multiple patterns versus a single pattern with alternatives in the description
302    of <b>-e</b> above.
303    </P>
304    <P>
305    <b>--file-list</b>=<i>filename</i>
306    Read a list of files to be searched from the given file, one per line. Trailing
307    white space is removed from each line, and blank lines are ignored. These files
308    are searched before any others that may be listed on the command line. The
309    filename can be given as "-" to refer to the standard input. If <b>--file</b>
310    and <b>--file-list</b> are both specified as "-", patterns are read first. This
311    is useful only when the standard input is a terminal, from which further lines
312    (the list of files) can be read after an end-of-file indication.
313  </P>  </P>
314  <P>  <P>
315  <b>--file-offsets</b>  <b>--file-offsets</b>
# Line 305  Output a help message, giving brief deta Line 341  Output a help message, giving brief deta
341  type support, and then exit.  type support, and then exit.
342  </P>  </P>
343  <P>  <P>
344    <b>-I</b>
345    Treat binary files as never matching. This is equivalent to
346    <b>--binary-files</b>=<i>without-match</i>.
347    </P>
348    <P>
349  <b>-i</b>, <b>--ignore-case</b>  <b>-i</b>, <b>--ignore-case</b>
350  Ignore upper/lower case distinctions during comparisons.  Ignore upper/lower case distinctions during comparisons.
351  </P>  </P>
# Line 537  a line) and in addition, require them to Line 578  a line) and in addition, require them to
578  equivalent to having ^ and $ characters at the start and end of each  equivalent to having ^ and $ characters at the start and end of each
579  alternative branch in every pattern.  alternative branch in every pattern.
580  </P>  </P>
581  <br><a name="SEC5" href="#TOC1">ENVIRONMENT VARIABLES</a><br>  <br><a name="SEC6" href="#TOC1">ENVIRONMENT VARIABLES</a><br>
582  <P>  <P>
583  The environment variables <b>LC_ALL</b> and <b>LC_CTYPE</b> are examined, in that  The environment variables <b>LC_ALL</b> and <b>LC_CTYPE</b> are examined, in that
584  order, for a locale. The first one that is set is used. This can be overridden  order, for a locale. The first one that is set is used. This can be overridden
585  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
586  (usually the "C" locale) is used.  (usually the "C" locale) is used.
587  </P>  </P>
588  <br><a name="SEC6" href="#TOC1">NEWLINES</a><br>  <br><a name="SEC7" href="#TOC1">NEWLINES</a><br>
589  <P>  <P>
590  The <b>-N</b> (<b>--newline</b>) option allows <b>pcregrep</b> to scan files with  The <b>-N</b> (<b>--newline</b>) option allows <b>pcregrep</b> to scan files with
591  different newline conventions from the default. However, the setting of this  different newline conventions from the default. However, the setting of this
# Line 553  the standard error and output streams. I Line 594  the standard error and output streams. I
594  <b>printf()</b> calls to indicate newlines, relying on the C I/O library to  <b>printf()</b> calls to indicate newlines, relying on the C I/O library to
595  convert this to an appropriate sequence if the output is sent to a file.  convert this to an appropriate sequence if the output is sent to a file.
596  </P>  </P>
597  <br><a name="SEC7" href="#TOC1">OPTIONS COMPATIBILITY</a><br>  <br><a name="SEC8" href="#TOC1">OPTIONS COMPATIBILITY</a><br>
598  <P>  <P>
599  Many of the short and long forms of <b>pcregrep</b>'s options are the same  Many of the short and long forms of <b>pcregrep</b>'s options are the same
600  as in the GNU <b>grep</b> program (version 2.5.4). Any long option of the form  as in the GNU <b>grep</b> program. Any long option of the form
601  <b>--xxx-regexp</b> (GNU terminology) is also available as <b>--xxx-regex</b>  <b>--xxx-regexp</b> (GNU terminology) is also available as <b>--xxx-regex</b>
602  (PCRE terminology). However, the <b>--file-offsets</b>, <b>--include-dir</b>,  (PCRE terminology). However, the <b>--file-list</b>, <b>--file-offsets</b>,
603  <b>--line-offsets</b>, <b>--locale</b>, <b>--match-limit</b>, <b>-M</b>,  <b>--include-dir</b>, <b>--line-offsets</b>, <b>--locale</b>, <b>--match-limit</b>,
604  <b>--multiline</b>, <b>-N</b>, <b>--newline</b>, <b>--recursion-limit</b>,  <b>-M</b>, <b>--multiline</b>, <b>-N</b>, <b>--newline</b>,
605  <b>-u</b>, and <b>--utf-8</b> options are specific to <b>pcregrep</b>, as is the  <b>--recursion-limit</b>, <b>-u</b>, and <b>--utf-8</b> options are specific to
606  use of the <b>--only-matching</b> option with a capturing parentheses number.  <b>pcregrep</b>, as is the use of the <b>--only-matching</b> option with a
607    capturing parentheses number.
608  </P>  </P>
609  <P>  <P>
610  Although most of the common options work the same way, a few are different in  Although most of the common options work the same way, a few are different in
# Line 571  for GNU <b>grep</b>, but a regular expre Line 613  for GNU <b>grep</b>, but a regular expre
613  <b>-c</b> and <b>-l</b> options are given, GNU grep lists only file names,  <b>-c</b> and <b>-l</b> options are given, GNU grep lists only file names,
614  without counts, but <b>pcregrep</b> gives the counts.  without counts, but <b>pcregrep</b> gives the counts.
615  </P>  </P>
616  <br><a name="SEC8" href="#TOC1">OPTIONS WITH DATA</a><br>  <br><a name="SEC9" href="#TOC1">OPTIONS WITH DATA</a><br>
617  <P>  <P>
618  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.
619  If a short form option is used, the data may follow immediately, or (with one  If a short form option is used, the data may follow immediately, or (with one
# Line 603  The exceptions to the above are the <b>- Line 645  The exceptions to the above are the <b>-
645  options does have data, it must be given in the first form, using an equals  options does have data, it must be given in the first form, using an equals
646  character. Otherwise <b>pcregrep</b> will assume that it has no data.  character. Otherwise <b>pcregrep</b> will assume that it has no data.
647  </P>  </P>
648  <br><a name="SEC9" href="#TOC1">MATCHING ERRORS</a><br>  <br><a name="SEC10" href="#TOC1">MATCHING ERRORS</a><br>
649  <P>  <P>
650  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
651  fail to match certain lines. Such patterns normally involve nested indefinite  fail to match certain lines. Such patterns normally involve nested indefinite
# Line 619  resource limit; there is a second option Line 661  resource limit; there is a second option
661  sets a limit on the amount of memory (usually stack) that is used (see the  sets a limit on the amount of memory (usually stack) that is used (see the
662  discussion of these options above).  discussion of these options above).
663  </P>  </P>
664  <br><a name="SEC10" href="#TOC1">DIAGNOSTICS</a><br>  <br><a name="SEC11" href="#TOC1">DIAGNOSTICS</a><br>
665  <P>  <P>
666  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
667  for syntax errors, overlong lines, non-existent or inaccessible files (even if  for syntax errors, overlong lines, non-existent or inaccessible files (even if
# Line 627  matches were found in other files) or to Line 669  matches were found in other files) or to
669  <b>-s</b> option to suppress error messages about inaccessible files does not  <b>-s</b> option to suppress error messages about inaccessible files does not
670  affect the return code.  affect the return code.
671  </P>  </P>
672  <br><a name="SEC11" href="#TOC1">SEE ALSO</a><br>  <br><a name="SEC12" href="#TOC1">SEE ALSO</a><br>
673  <P>  <P>
674  <b>pcrepattern</b>(3), <b>pcretest</b>(1).  <b>pcrepattern</b>(3), <b>pcretest</b>(1).
675  </P>  </P>
676  <br><a name="SEC12" href="#TOC1">AUTHOR</a><br>  <br><a name="SEC13" href="#TOC1">AUTHOR</a><br>
677  <P>  <P>
678  Philip Hazel  Philip Hazel
679  <br>  <br>
# Line 640  University Computing Service Line 682  University Computing Service
682  Cambridge CB2 3QH, England.  Cambridge CB2 3QH, England.
683  <br>  <br>
684  </P>  </P>
685  <br><a name="SEC13" href="#TOC1">REVISION</a><br>  <br><a name="SEC14" href="#TOC1">REVISION</a><br>
686  <P>  <P>
687  Last updated: 06 September 2011  Last updated: 04 March 2012
688  <br>  <br>
689  Copyright &copy; 1997-2011 University of Cambridge.  Copyright &copy; 1997-2012 University of Cambridge.
690  <br>  <br>
691  <p>  <p>
692  Return to the <a href="index.html">PCRE index page</a>.  Return to the <a href="index.html">PCRE index page</a>.

Legend:
Removed from v.953  
changed lines
  Added in v.954

  ViewVC Help
Powered by ViewVC 1.1.5