/[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 150 by ph10, Tue Apr 17 08:22:40 2007 UTC revision 453 by ph10, Fri Sep 18 19:12:35 2009 UTC
# Line 15  man page, in case the conversion went wr Line 15  man page, in case the conversion went wr
15  <ul>  <ul>
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">OPTIONS</a>  <li><a name="TOC3" href="#SEC3">SUPPORT FOR COMPRESSED FILES</a>
19  <li><a name="TOC4" href="#SEC4">ENVIRONMENT VARIABLES</a>  <li><a name="TOC4" href="#SEC4">OPTIONS</a>
20  <li><a name="TOC5" href="#SEC5">NEWLINES</a>  <li><a name="TOC5" href="#SEC5">ENVIRONMENT VARIABLES</a>
21  <li><a name="TOC6" href="#SEC6">OPTIONS COMPATIBILITY</a>  <li><a name="TOC6" href="#SEC6">NEWLINES</a>
22  <li><a name="TOC7" href="#SEC7">OPTIONS WITH DATA</a>  <li><a name="TOC7" href="#SEC7">OPTIONS COMPATIBILITY</a>
23  <li><a name="TOC8" href="#SEC8">MATCHING ERRORS</a>  <li><a name="TOC8" href="#SEC8">OPTIONS WITH DATA</a>
24  <li><a name="TOC9" href="#SEC9">DIAGNOSTICS</a>  <li><a name="TOC9" href="#SEC9">MATCHING ERRORS</a>
25  <li><a name="TOC10" href="#SEC10">SEE ALSO</a>  <li><a name="TOC10" href="#SEC10">DIAGNOSTICS</a>
26  <li><a name="TOC11" href="#SEC11">AUTHOR</a>  <li><a name="TOC11" href="#SEC11">SEE ALSO</a>
27  <li><a name="TOC12" href="#SEC12">REVISION</a>  <li><a name="TOC12" href="#SEC12">AUTHOR</a>
28    <li><a name="TOC13" href="#SEC13">REVISION</a>
29  </ul>  </ul>
30  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>  <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
31  <P>  <P>
# Line 47  without delimiters. For example: Line 48  without delimiters. For example:
48  </pre>  </pre>
49  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
50  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
51  pattern. Quotes can of course be used on the command line because they are  pattern. Quotes can of course be used to delimit patterns on the command line
52  interpreted by the shell, and indeed they are required if a pattern contains  because they are interpreted by the shell, and indeed they are required if a
53  white space or shell metacharacters.  pattern contains white space or shell metacharacters.
54  </P>  </P>
55  <P>  <P>
56  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
# Line 65  For example: Line 66  For example:
66  <pre>  <pre>
67    pcregrep some-pattern /file1 - /file3    pcregrep some-pattern /file1 - /file3
68  </pre>  </pre>
69  By default, each line that matches the pattern is copied to the standard  By default, each line that matches a pattern is copied to the standard
70  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
71  start of each line. However, there are options that can change how  start of each line, followed by a colon. However, there are options that can
72  <b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it possible to  change how <b>pcregrep</b> behaves. In particular, the <b>-M</b> option makes it
73  search for patterns that span line boundaries. What defines a line boundary is  possible to search for patterns that span line boundaries. What defines a line
74  controlled by the <b>-N</b> (<b>--newline</b>) option.  boundary is controlled by the <b>-N</b> (<b>--newline</b>) option.
75  </P>  </P>
76  <P>  <P>
77  Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.  Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
78  BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>.  BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>. When there is more than one pattern
79    (specified by the use of <b>-e</b> and/or <b>-f</b>), each pattern is applied to
80    each line in the order in which they are defined, except that all the <b>-e</b>
81    patterns are tried before the <b>-f</b> patterns.
82    </P>
83    <P>
84    By default, as soon as one pattern matches (or fails to match when <b>-v</b> is
85    used), no further patterns are considered. However, if <b>--colour</b> (or
86    <b>--color</b>) is used to colour the matching substrings, or if
87    <b>--only-matching</b>, <b>--file-offsets</b>, or <b>--line-offsets</b> is used to
88    output only the part of the line that matched (either shown literally, or as an
89    offset), scanning resumes immediately following the match, so that further
90    matches on the same line can be found. If there are multiple patterns, they are
91    all tried on the remainder of the line, but patterns that follow the one that
92    matched are not tried on the earlier part of the line.
93    </P>
94    <P>
95    This is the same behaviour as GNU grep, but it does mean that the order in
96    which multiple patterns are specified can affect the output when one of the
97    above options is used.
98    </P>
99    <P>
100    Patterns that can match an empty string are accepted, but empty string
101    matches are never recognized. An example is the pattern "(super)?(man)?", in
102    which all components are optional. This pattern finds all occurrences of both
103    "super" and "man"; the output differs from matching with "super|man" when only
104    the matching substrings are being shown.
105  </P>  </P>
106  <P>  <P>
107  If the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variable is set,  If the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variable is set,
108  <b>pcregrep</b> uses the value to set a locale when calling the PCRE library.  <b>pcregrep</b> uses the value to set a locale when calling the PCRE library.
109  The <b>--locale</b> option can be used to override this.  The <b>--locale</b> option can be used to override this.
110  </P>  </P>
111  <br><a name="SEC3" href="#TOC1">OPTIONS</a><br>  <br><a name="SEC3" href="#TOC1">SUPPORT FOR COMPRESSED FILES</a><br>
112    <P>
113    It is possible to compile <b>pcregrep</b> so that it uses <b>libz</b> or
114    <b>libbz2</b> to read files whose names end in <b>.gz</b> or <b>.bz2</b>,
115    respectively. You can find out whether your binary has support for one or both
116    of these file types by running it with the <b>--help</b> option. If the
117    appropriate support is not present, files are treated as plain text. The
118    standard input is always so treated.
119    </P>
120    <br><a name="SEC4" href="#TOC1">OPTIONS</a><br>
121    <P>
122    The order in which some of the options appear can affect the output. For
123    example, both the <b>-h</b> and <b>-l</b> options affect the printing of file
124    names. Whichever comes later in the command line will be the one that takes
125    effect.
126    </P>
127  <P>  <P>
128  <b>--</b>  <b>--</b>
129  This terminate the list of options. It is useful if the next item on the  This terminate the list of options. It is useful if the next item on the
# Line 113  This is equivalent to setting both <b>-A Line 155  This is equivalent to setting both <b>-A
155  </P>  </P>
156  <P>  <P>
157  <b>-c</b>, <b>--count</b>  <b>-c</b>, <b>--count</b>
158  Do not output individual lines; instead just output a count of the number of  Do not output individual lines from the files that are being scanned; instead
159  lines that would otherwise have been output. If several files are given, a  output the number of lines that would otherwise have been shown. If no lines
160  count is output for each of them. In this mode, the <b>-A</b>, <b>-B</b>, and  are selected, the number zero is output. If several files are are being
161  <b>-C</b> options are ignored.  scanned, a count is output for each of them. However, if the
162    <b>--files-with-matches</b> option is also used, only those files whose counts
163    are greater than zero are listed. When <b>-c</b> is used, the <b>-A</b>,
164    <b>-B</b>, and <b>-C</b> options are ignored.
165  </P>  </P>
166  <P>  <P>
167  <b>--colour</b>, <b>--color</b>  <b>--colour</b>, <b>--color</b>
# Line 126  equals sign. Line 171  equals sign.
171  </P>  </P>
172  <P>  <P>
173  <b>--colour=</b><i>value</i>, <b>--color=</b><i>value</i>  <b>--colour=</b><i>value</i>, <b>--color=</b><i>value</i>
174  This option specifies under what circumstances the part of a line that matched  This option specifies under what circumstances the parts of a line that matched
175  a pattern should be coloured in the output. The value may be "never" (the  a pattern should be coloured in the output. By default, the output is not
176  default), "always", or "auto". In the latter case, colouring happens only if  coloured. The value (which is optional, see above) may be "never", "always", or
177  the standard output is connected to a terminal. The colour can be specified by  "auto". In the latter case, colouring happens only if the standard output is
178  setting the environment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value  connected to a terminal. More resources are used when colouring is enabled,
179  of this variable should be a string of two numbers, separated by a semicolon.  because <b>pcregrep</b> has to search for all possible matches in a line, not
180  They are copied directly into the control string for setting colour on a  just one, in order to colour them all.
181  terminal, so it is your responsibility to ensure that they make sense. If  </P>
182  neither of the environment variables is set, the default is "1;31", which gives  <P>
183  red.  The colour that is used can be specified by setting the environment variable
184    PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a
185    string of two numbers, separated by a semicolon. They are copied directly into
186    the control string for setting colour on a terminal, so it is your
187    responsibility to ensure that they make sense. If neither of the environment
188    variables is set, the default is "1;31", which gives red.
189  </P>  </P>
190  <P>  <P>
191  <b>-D</b> <i>action</i>, <b>--devices=</b><i>action</i>  <b>-D</b> <i>action</i>, <b>--devices=</b><i>action</i>
# Line 152  are read as if they were ordinary files. Line 202  are read as if they were ordinary files.
202  of reading a directory like this is an immediate end-of-file.  of reading a directory like this is an immediate end-of-file.
203  </P>  </P>
204  <P>  <P>
205  <b>-e</b> <i>pattern</i>, <b>--regex=</b><i>pattern</i>,  <b>-e</b> <i>pattern</i>, <b>--regex=</b><i>pattern</i>, <b>--regexp=</b><i>pattern</i>
206  <b>--regexp=</b><i>pattern</i> Specify a pattern to be matched. This option can  Specify a pattern to be matched. This option can be used multiple times in
207  be used multiple times in order to specify several patterns. It can also be  order to specify several patterns. It can also be used as a way of specifying a
208  used as a way of specifying a single pattern that starts with a hyphen. When  single pattern that starts with a hyphen. When <b>-e</b> is used, no argument
209  <b>-e</b> is used, no argument pattern is taken from the command line; all  pattern is taken from the command line; all arguments are treated as file
210  arguments are treated as file names. There is an overall maximum of 100  names. There is an overall maximum of 100 patterns. They are applied to each
211  patterns. They are applied to each line in the order in which they are defined  line in the order in which they are defined until one matches (or fails to
212  until one matches (or fails to match if <b>-v</b> is used). If <b>-f</b> is used  match if <b>-v</b> is used). If <b>-f</b> is used with <b>-e</b>, the command line
213  with <b>-e</b>, the command line patterns are matched first, followed by the  patterns are matched first, followed by the patterns from the file, independent
214  patterns from the file, independent of the order in which these options are  of the order in which these options are specified. Note that multiple use of
215  specified. Note that multiple use of <b>-e</b> is not the same as a single  <b>-e</b> is not the same as a single pattern with alternatives. For example,
216  pattern with alternatives. For example, X|Y finds the first character in a line  X|Y finds the first character in a line that is X or Y, whereas if the two
217  that is X or Y, whereas if the two patterns are given separately,  patterns are given separately, <b>pcregrep</b> finds X if it is present, even if
218  <b>pcregrep</b> finds X if it is present, even if it follows Y in the line. It  it follows Y in the line. It finds Y only if there is no X in the line. This
219  finds Y only if there is no X in the line. This really matters only if you are  really matters only if you are using <b>-o</b> to show the part(s) of the line
220  using <b>-o</b> to show the portion of the line that matched.  that matched.
221  </P>  </P>
222  <P>  <P>
223  <b>--exclude</b>=<i>pattern</i>  <b>--exclude</b>=<i>pattern</i>
224  When <b>pcregrep</b> is searching the files in a directory as a consequence of  When <b>pcregrep</b> is searching the files in a directory as a consequence of
225  the <b>-r</b> (recursive search) option, any files whose names match the pattern  the <b>-r</b> (recursive search) option, any regular files whose names match the
226  are excluded. The pattern is a PCRE regular expression. If a file name matches  pattern are excluded. Subdirectories are not excluded by this option; they are
227  both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no short  searched recursively, subject to the <b>--exclude_dir</b> and
228  form for this option.  <b>--include_dir</b> options. The pattern is a PCRE regular expression, and is
229    matched against the final component of the file name (not the entire path). If
230    a file name matches both <b>--include</b> and <b>--exclude</b>, it is excluded.
231    There is no short form for this option.
232    </P>
233    <P>
234    <b>--exclude_dir</b>=<i>pattern</i>
235    When <b>pcregrep</b> is searching the contents of a directory as a consequence
236    of the <b>-r</b> (recursive search) option, any subdirectories whose names match
237    the pattern are excluded. (Note that the \fP--exclude\fP option does not affect
238    subdirectories.) The pattern is a PCRE regular expression, and is matched
239    against the final component of the name (not the entire path). If a
240    subdirectory name matches both <b>--include_dir</b> and <b>--exclude_dir</b>, it
241    is excluded. There is no short form for this option.
242  </P>  </P>
243  <P>  <P>
244  <b>-F</b>, <b>--fixed-strings</b>  <b>-F</b>, <b>--fixed-strings</b>
# Line 195  present; they are tested before the file Line 258  present; they are tested before the file
258  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 file names. There
259  is an overall maximum of 100 patterns. Trailing white space is removed from  is an overall maximum of 100 patterns. Trailing white space is removed from
260  each line, and blank lines are ignored. An empty file contains no patterns and  each line, and blank lines are ignored. An empty file contains no patterns and
261  therefore matches nothing.  therefore matches nothing. See also the comments about multiple patterns versus
262    a single pattern with alternatives in the description of <b>-e</b> above.
263    </P>
264    <P>
265    <b>--file-offsets</b>
266    Instead of showing lines or parts of lines that match, show each match as an
267    offset from the start of the file and a length, separated by a comma. In this
268    mode, no context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b>
269    options are ignored. If there is more than one match in a line, each of them is
270    shown separately. This option is mutually exclusive with <b>--line-offsets</b>
271    and <b>--only-matching</b>.
272  </P>  </P>
273  <P>  <P>
274  <b>-H</b>, <b>--with-filename</b>  <b>-H</b>, <b>--with-filename</b>
275  Force the inclusion of the filename at the start of output lines when searching  Force the inclusion of the filename at the start of output lines when searching
276  a single file. By default, the filename is not shown in this case. For matching  a single file. By default, the filename is not shown in this case. For matching
277  lines, the filename is followed by a colon and a space; for context lines, a  lines, the filename is followed by a colon; for context lines, a hyphen
278  hyphen separator is used. If a line number is also being output, it follows the  separator is used. If a line number is also being output, it follows the file
279  file name without a space.  name.
280  </P>  </P>
281  <P>  <P>
282  <b>-h</b>, <b>--no-filename</b>  <b>-h</b>, <b>--no-filename</b>
283  Suppress the output filenames when searching multiple files. By default,  Suppress the output filenames when searching multiple files. By default,
284  filenames are shown when multiple files are searched. For matching lines, the  filenames are shown when multiple files are searched. For matching lines, the
285  filename is followed by a colon and a space; for context lines, a hyphen  filename is followed by a colon; for context lines, a hyphen separator is used.
286  separator is used. If a line number is also being output, it follows the file  If a line number is also being output, it follows the file name.
 name without a space.  
287  </P>  </P>
288  <P>  <P>
289  <b>--help</b>  <b>--help</b>
290  Output a brief help message and exit.  Output a help message, giving brief details of the command options and file
291    type support, and then exit.
292  </P>  </P>
293  <P>  <P>
294  <b>-i</b>, <b>--ignore-case</b>  <b>-i</b>, <b>--ignore-case</b>
# Line 224  Ignore upper/lower case distinctions dur Line 297  Ignore upper/lower case distinctions dur
297  <P>  <P>
298  <b>--include</b>=<i>pattern</i>  <b>--include</b>=<i>pattern</i>
299  When <b>pcregrep</b> is searching the files in a directory as a consequence of  When <b>pcregrep</b> is searching the files in a directory as a consequence of
300  the <b>-r</b> (recursive search) option, only those files whose names match the  the <b>-r</b> (recursive search) option, only those regular files whose names
301  pattern are included. The pattern is a PCRE regular expression. If a file name  match the pattern are included. Subdirectories are always included and searched
302  matches both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no  recursively, subject to the \fP--include_dir\fP and <b>--exclude_dir</b>
303  short form for this option.  options. The pattern is a PCRE regular expression, and is matched against the
304    final component of the file name (not the entire path). If a file name matches
305    both <b>--include</b> and <b>--exclude</b>, it is excluded. There is no short
306    form for this option.
307    </P>
308    <P>
309    <b>--include_dir</b>=<i>pattern</i>
310    When <b>pcregrep</b> is searching the contents of a directory as a consequence
311    of the <b>-r</b> (recursive search) option, only those subdirectories whose
312    names match the pattern are included. (Note that the <b>--include</b> option
313    does not affect subdirectories.) The pattern is a PCRE regular expression, and
314    is matched against the final component of the name (not the entire path). If a
315    subdirectory name matches both <b>--include_dir</b> and <b>--exclude_dir</b>, it
316    is excluded. There is no short form for this option.
317  </P>  </P>
318  <P>  <P>
319  <b>-L</b>, <b>--files-without-match</b>  <b>-L</b>, <b>--files-without-match</b>
# Line 239  output once, on a separate line. Line 325  output once, on a separate line.
325  <b>-l</b>, <b>--files-with-matches</b>  <b>-l</b>, <b>--files-with-matches</b>
326  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
327  containing lines that would have been output. Each file name is output  containing lines that would have been output. Each file name is output
328  once, on a separate line. Searching stops as soon as a matching line is found  once, on a separate line. Searching normally stops as soon as a matching line
329  in a file.  is found in a file. However, if the <b>-c</b> (count) option is also used,
330    matching continues in order to obtain the correct count, and those files that
331    have at least one match are listed along with their counts. Using this option
332    with <b>-c</b> is a way of suppressing the listing of files with no matches.
333  </P>  </P>
334  <P>  <P>
335  <b>--label</b>=<i>name</i>  <b>--label</b>=<i>name</i>
# Line 249  are being output. If not supplied, "(sta Line 338  are being output. If not supplied, "(sta
338  short form for this option.  short form for this option.
339  </P>  </P>
340  <P>  <P>
341    <b>--line-offsets</b>
342    Instead of showing lines or parts of lines that match, show each match as a
343    line number, the offset from the start of the line, and a length. The line
344    number is terminated by a colon (as usual; see the <b>-n</b> option), and the
345    offset and length are separated by a comma. In this mode, no context is shown.
346    That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are ignored. If there is
347    more than one match in a line, each of them is shown separately. This option is
348    mutually exclusive with <b>--file-offsets</b> and <b>--only-matching</b>.
349    </P>
350    <P>
351  <b>--locale</b>=<i>locale-name</i>  <b>--locale</b>=<i>locale-name</i>
352  This option specifies a locale to be used for pattern matching. It overrides  This option specifies a locale to be used for pattern matching. It overrides
353  the value in the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variables. If no  the value in the <b>LC_ALL</b> or <b>LC_CTYPE</b> environment variables. If no
# Line 292  being scanned does not agree with the co Line 391  being scanned does not agree with the co
391  <P>  <P>
392  <b>-n</b>, <b>--line-number</b>  <b>-n</b>, <b>--line-number</b>
393  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
394  and a space for matching lines or a hyphen and a space for context lines. If  for matching lines or a hyphen for context lines. If the filename is also being
395  the filename is also being output, it precedes the line number.  output, it precedes the line number. This option is forced if
396    <b>--line-offsets</b> is used.
397  </P>  </P>
398  <P>  <P>
399  <b>-o</b>, <b>--only-matching</b>  <b>-o</b>, <b>--only-matching</b>
400  Show only the part of the line that matched a pattern. In this mode, no  Show only the part of the line that matched a pattern. In this mode, no
401  context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are  context is shown. That is, the <b>-A</b>, <b>-B</b>, and <b>-C</b> options are
402  ignored.  ignored. If there is more than one match in a line, each of them is shown
403    separately. If <b>-o</b> is combined with <b>-v</b> (invert the sense of the
404    match to find non-matching lines), no output is generated, but the return code
405    is set appropriately. This option is mutually exclusive with
406    <b>--file-offsets</b> and <b>--line-offsets</b>.
407  </P>  </P>
408  <P>  <P>
409  <b>-q</b>, <b>--quiet</b>  <b>-q</b>, <b>--quiet</b>
# Line 348  a line) and in addition, require them to Line 452  a line) and in addition, require them to
452  equivalent to having ^ and $ characters at the start and end of each  equivalent to having ^ and $ characters at the start and end of each
453  alternative branch in every pattern.  alternative branch in every pattern.
454  </P>  </P>
455  <br><a name="SEC4" href="#TOC1">ENVIRONMENT VARIABLES</a><br>  <br><a name="SEC5" href="#TOC1">ENVIRONMENT VARIABLES</a><br>
456  <P>  <P>
457  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
458  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
459  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
460  (usually the "C" locale) is used.  (usually the "C" locale) is used.
461  </P>  </P>
462  <br><a name="SEC5" href="#TOC1">NEWLINES</a><br>  <br><a name="SEC6" href="#TOC1">NEWLINES</a><br>
463  <P>  <P>
464  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
465  different newline conventions from the default. However, the setting of this  different newline conventions from the default. However, the setting of this
# Line 364  the standard error and output streams. I Line 468  the standard error and output streams. I
468  <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
469  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.
470  </P>  </P>
471  <br><a name="SEC6" href="#TOC1">OPTIONS COMPATIBILITY</a><br>  <br><a name="SEC7" href="#TOC1">OPTIONS COMPATIBILITY</a><br>
472  <P>  <P>
473  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
474  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
475  <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>
476  (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>,
477  <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>. If both the
478    <b>-c</b> and <b>-l</b> options are given, GNU grep lists only file names,
479    without counts, but <b>pcregrep</b> gives the counts.
480  </P>  </P>
481  <br><a name="SEC7" href="#TOC1">OPTIONS WITH DATA</a><br>  <br><a name="SEC8" href="#TOC1">OPTIONS WITH DATA</a><br>
482  <P>  <P>
483  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.
484  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 399  for which the data is optional. If this Line 505  for which the data is optional. If this
505  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
506  it has no data.  it has no data.
507  </P>  </P>
508  <br><a name="SEC8" href="#TOC1">MATCHING ERRORS</a><br>  <br><a name="SEC9" href="#TOC1">MATCHING ERRORS</a><br>
509  <P>  <P>
510  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
511  fail to match certain lines. Such patterns normally involve nested indefinite  fail to match certain lines. Such patterns normally involve nested indefinite
# Line 409  in these circumstances. If this happens, Line 515  in these circumstances. If this happens,
515  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
516  there are more than 20 such errors, <b>pcregrep</b> gives up.  there are more than 20 such errors, <b>pcregrep</b> gives up.
517  </P>  </P>
518  <br><a name="SEC9" href="#TOC1">DIAGNOSTICS</a><br>  <br><a name="SEC10" href="#TOC1">DIAGNOSTICS</a><br>
519  <P>  <P>
520  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
521  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 417  found in other files) or too many matchi Line 523  found in other files) or too many matchi
523  suppress error messages about inaccessble files does not affect the return  suppress error messages about inaccessble files does not affect the return
524  code.  code.
525  </P>  </P>
526  <br><a name="SEC10" href="#TOC1">SEE ALSO</a><br>  <br><a name="SEC11" href="#TOC1">SEE ALSO</a><br>
527  <P>  <P>
528  <b>pcrepattern</b>(3), <b>pcretest</b>(1).  <b>pcrepattern</b>(3), <b>pcretest</b>(1).
529  </P>  </P>
530  <br><a name="SEC11" href="#TOC1">AUTHOR</a><br>  <br><a name="SEC12" href="#TOC1">AUTHOR</a><br>
531  <P>  <P>
532  Philip Hazel  Philip Hazel
533  <br>  <br>
# Line 430  University Computing Service Line 536  University Computing Service
536  Cambridge CB2 3QH, England.  Cambridge CB2 3QH, England.
537  <br>  <br>
538  </P>  </P>
539  <br><a name="SEC12" href="#TOC1">REVISION</a><br>  <br><a name="SEC13" href="#TOC1">REVISION</a><br>
540  <P>  <P>
541  Last updated: 16 April 2007  Last updated: 13 September 2009
542  <br>  <br>
543  Copyright &copy; 1997-2007 University of Cambridge.  Copyright &copy; 1997-2009 University of Cambridge.
544  <br>  <br>
545  <p>  <p>
546  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.150  
changed lines
  Added in v.453

  ViewVC Help
Powered by ViewVC 1.1.5