/[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 281 by ph10, Fri Dec 7 15:57:05 2007 UTC revision 378 by ph10, Sun Mar 1 14:13:34 2009 UTC
# Line 47  possible to search for patterns that spa Line 47  possible to search for patterns that spa
47  boundary is controlled by the \fB-N\fP (\fB--newline\fP) option.  boundary is 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. When there is more than one pattern  BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern
51  (specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to  (specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to
52  each line in the order in which they are defined, except that all the \fB-e\fP  each line in the order in which they are defined, except that all the \fB-e\fP
53  patterns are tried before the \fB-f\fP patterns. As soon as one pattern matches  patterns are tried before the \fB-f\fP patterns. As soon as one pattern matches
54  (or fails to match when \fB-v\fP is used), no further patterns are considered.  (or fails to match when \fB-v\fP is used), no further patterns are considered.
55  .P  .P
56  When \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP  When \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP
57  is used, the output is the part of the line that matched (either shown  is used, the output is the part of the line that matched (either shown
58  literally, or as an offset). In this case, scanning resumes immediately  literally, or as an offset). In this case, scanning resumes immediately
59  following the match, so that further matches on the same line can be found.  following the match, so that further matches on the same line can be found.
60  If there are multiple patterns, they are all tried on the remainder of the  If there are multiple patterns, they are all tried on the remainder of the
61  line. However, patterns that follow the one that matched are not tried on the  line. However, patterns that follow the one that matched are not tried on the
62  earlier part of the line.  earlier part of the line.
63  .P  .P
64  If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set,  If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set,
65  \fBpcregrep\fP uses the value to set a locale when calling the PCRE library.  \fBpcregrep\fP uses the value to set a locale when calling the PCRE library.
66  The \fB--locale\fP option can be used to override this.  The \fB--locale\fP option can be used to override this.
67  .  .
68    .SH "SUPPORT FOR COMPRESSED FILES"
69    .rs
70    .sp
71    It is possible to compile \fBpcregrep\fP so that it uses \fBlibz\fP or
72    \fBlibbz2\fP to read files whose names end in \fB.gz\fP or \fB.bz2\fP,
73    respectively. You can find out whether your binary has support for one or both
74    of these file types by running it with the \fB--help\fP option. If the
75    appropriate support is not present, files are treated as plain text. The
76    standard input is always so treated.
77    .
78  .SH OPTIONS  .SH OPTIONS
79  .rs  .rs
80  .TP 10  .TP 10
# Line 105  If data is required, it must be given in Line 115  If data is required, it must be given in
115  equals sign.  equals sign.
116  .TP  .TP
117  \fB--colour=\fP\fIvalue\fP, \fB--color=\fP\fIvalue\fP  \fB--colour=\fP\fIvalue\fP, \fB--color=\fP\fIvalue\fP
118  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
119  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
120  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
121  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
122  setting the environment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value  connected to a terminal. More resources are used when colouring is enabled,
123  of this variable should be a string of two numbers, separated by a semicolon.  because \fBpcregrep\fP has to search for all possible matches in a line, not
124  They are copied directly into the control string for setting colour on a  just one, in order to colour them all.
125  terminal, so it is your responsibility to ensure that they make sense. If  
126  neither of the environment variables is set, the default is "1;31", which gives  The colour that is used can be specified by setting the environment variable
127  red.  PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a
128    string of two numbers, separated by a semicolon. They are copied directly into
129    the control string for setting colour on a terminal, so it is your
130    responsibility to ensure that they make sense. If neither of the environment
131    variables is set, the default is "1;31", which gives red.
132  .TP  .TP
133  \fB-D\fP \fIaction\fP, \fB--devices=\fP\fIaction\fP  \fB-D\fP \fIaction\fP, \fB--devices=\fP\fIaction\fP
134  If an input path is not a regular file or a directory, "action" specifies how  If an input path is not a regular file or a directory, "action" specifies how
# Line 128  option), or "skip" (silently skip the pa Line 142  option), or "skip" (silently skip the pa
142  are read as if they were ordinary files. In some operating systems the effect  are read as if they were ordinary files. In some operating systems the effect
143  of reading a directory like this is an immediate end-of-file.  of reading a directory like this is an immediate end-of-file.
144  .TP  .TP
145  \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
146  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
147  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
148  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
# Line 147  that matched. Line 161  that matched.
161  .TP  .TP
162  \fB--exclude\fP=\fIpattern\fP  \fB--exclude\fP=\fIpattern\fP
163  When \fBpcregrep\fP is searching the files in a directory as a consequence of  When \fBpcregrep\fP is searching the files in a directory as a consequence of
164  the \fB-r\fP (recursive search) option, any files whose names match the pattern  the \fB-r\fP (recursive search) option, any regular files whose names match the
165  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
166  both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short  searched recursively, subject to the \fB--exclude_dir\fP and
167  form for this option.  \fB--include_dir\fP options. The pattern is a PCRE regular expression, and is
168    matched against the final component of the file name (not the entire path). If
169    a file name matches both \fB--include\fP and \fB--exclude\fP, it is excluded.
170    There is no short form for this option.
171    .TP
172    \fB--exclude_dir\fP=\fIpattern\fP
173    When \fBpcregrep\fP is searching the contents of a directory as a consequence
174    of the \fB-r\fP (recursive search) option, any subdirectories whose names match
175    the pattern are excluded. (Note that the \fP--exclude\fP option does not affect
176    subdirectories.) The pattern is a PCRE regular expression, and is matched
177    against the final component of the name (not the entire path). If a
178    subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
179    is excluded. There is no short form for this option.
180  .TP  .TP
181  \fB-F\fP, \fB--fixed-strings\fP  \fB-F\fP, \fB--fixed-strings\fP
182  Interpret each pattern as a list of fixed strings, separated by newlines,  Interpret each pattern as a list of fixed strings, separated by newlines,
# Line 168  present; they are tested before the file Line 194  present; they are tested before the file
194  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
195  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
196  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
197  therefore matches nothing. See also the comments about multiple patterns versus  therefore matches nothing. See also the comments about multiple patterns versus
198  a single pattern with alternatives in the description of \fB-e\fP above.  a single pattern with alternatives in the description of \fB-e\fP above.
199  .TP  .TP
200  \fB--file-offsets\fP  \fB--file-offsets\fP
# Line 182  and \fB--only-matching\fP. Line 208  and \fB--only-matching\fP.
208  \fB-H\fP, \fB--with-filename\fP  \fB-H\fP, \fB--with-filename\fP
209  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
210  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
211  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
212  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
213  file name without a space.  name.
214  .TP  .TP
215  \fB-h\fP, \fB--no-filename\fP  \fB-h\fP, \fB--no-filename\fP
216  Suppress the output filenames when searching multiple files. By default,  Suppress the output filenames when searching multiple files. By default,
217  filenames are shown when multiple files are searched. For matching lines, the  filenames are shown when multiple files are searched. For matching lines, the
218  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.
219  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.  
220  .TP  .TP
221  \fB--help\fP  \fB--help\fP
222  Output a brief help message and exit.  Output a help message, giving brief details of the command options and file
223    type support, and then exit.
224  .TP  .TP
225  \fB-i\fP, \fB--ignore-case\fP  \fB-i\fP, \fB--ignore-case\fP
226  Ignore upper/lower case distinctions during comparisons.  Ignore upper/lower case distinctions during comparisons.
227  .TP  .TP
228  \fB--include\fP=\fIpattern\fP  \fB--include\fP=\fIpattern\fP
229  When \fBpcregrep\fP is searching the files in a directory as a consequence of  When \fBpcregrep\fP is searching the files in a directory as a consequence of
230  the \fB-r\fP (recursive search) option, only those files whose names match the  the \fB-r\fP (recursive search) option, only those regular files whose names
231  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
232  matches both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no  recursively, subject to the \fP--include_dir\fP and \fB--exclude_dir\fP
233  short form for this option.  options. The pattern is a PCRE regular expression, and is matched against the
234    final component of the file name (not the entire path). If a file name matches
235    both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short
236    form for this option.
237    .TP
238    \fB--include_dir\fP=\fIpattern\fP
239    When \fBpcregrep\fP is searching the contents of a directory as a consequence
240    of the \fB-r\fP (recursive search) option, only those subdirectories whose
241    names match the pattern are included. (Note that the \fB--include\fP option
242    does not affect subdirectories.) The pattern is a PCRE regular expression, and
243    is matched against the final component of the name (not the entire path). If a
244    subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
245    is excluded. There is no short form for this option.
246  .TP  .TP
247  \fB-L\fP, \fB--files-without-match\fP  \fB-L\fP, \fB--files-without-match\fP
248  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
# Line 223  are being output. If not supplied, "(sta Line 261  are being output. If not supplied, "(sta
261  short form for this option.  short form for this option.
262  .TP  .TP
263  \fB--line-offsets\fP  \fB--line-offsets\fP
264  Instead of showing lines or parts of lines that match, show each match as a  Instead of showing lines or parts of lines that match, show each match as a
265  line number, the offset from the start of the line, and a length. The line  line number, the offset from the start of the line, and a length. The line
266  number is terminated by a colon (as usual; see the \fB-n\fP option), and the  number is terminated by a colon (as usual; see the \fB-n\fP option), and the
267  offset and length are separated by a comma. In this mode, no context is shown.  offset and length are separated by a comma. In this mode, no context is shown.
268  That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is  That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is
269  more than one match in a line, each of them is shown separately. This option is  more than one match in a line, each of them is shown separately. This option is
# Line 270  being scanned does not agree with the co Line 308  being scanned does not agree with the co
308  .TP  .TP
309  \fB-n\fP, \fB--line-number\fP  \fB-n\fP, \fB--line-number\fP
310  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
311  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
312  the filename is also being output, it precedes the line number. This option is  output, it precedes the line number. This option is forced if
313  forced if \fB--line-offsets\fP is used.  \fB--line-offsets\fP is used.
314  .TP  .TP
315  \fB-o\fP, \fB--only-matching\fP  \fB-o\fP, \fB--only-matching\fP
316  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
317  context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are  context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are
318  ignored. If there is more than one match in a line, each of them is shown  ignored. If there is more than one match in a line, each of them is shown
319  separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the  separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the
320  match to find non-matching lines), no output is generated, but the return code  match to find non-matching lines), no output is generated, but the return code
321  is set appropriately. This option is mutually exclusive with  is set appropriately. This option is mutually exclusive with
322  \fB--file-offsets\fP and \fB--line-offsets\fP.  \fB--file-offsets\fP and \fB--line-offsets\fP.
323  .TP  .TP
324  \fB-q\fP, \fB--quiet\fP  \fB-q\fP, \fB--quiet\fP
# Line 423  Cambridge CB2 3QH, England. Line 461  Cambridge CB2 3QH, England.
461  .rs  .rs
462  .sp  .sp
463  .nf  .nf
464  Last updated: 07 December 2007  Last updated: 01 March 2009
465  Copyright (c) 1997-2007 University of Cambridge.  Copyright (c) 1997-2009 University of Cambridge.
466  .fi  .fi

Legend:
Removed from v.281  
changed lines
  Added in v.378

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12