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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 420 - (hide annotations) (download)
Wed Aug 12 17:32:27 2009 UTC (5 years, 4 months ago) by ph10
File size: 24385 byte(s)
Fix infelicities to do with --count in pcregrep.

1 nigel 49 .TH PCREGREP 1
2     .SH NAME
3     pcregrep - a grep with Perl-compatible regular expressions.
4     .SH SYNOPSIS
5 nigel 87 .B pcregrep [options] [long options] [pattern] [path1 path2 ...]
6 nigel 75 .
7 nigel 49 .SH DESCRIPTION
8 nigel 63 .rs
9     .sp
10 nigel 75 \fBpcregrep\fP searches files for character patterns, in the same way as other
11 nigel 49 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
13 nigel 63 .\" HREF
14 nigel 93 \fBpcrepattern\fP(3)
15 nigel 63 .\"
16 nigel 93 for a full description of syntax and semantics of the regular expressions
17     that PCRE supports.
18 nigel 75 .P
19 nigel 87 Patterns, whether supplied on the command line or in a separate file, are given
20     without delimiters. For example:
21     .sp
22     pcregrep Thursday /etc/motd
23     .sp
24     If you attempt to use delimiters (for example, by surrounding a pattern with
25     slashes, as is common in Perl scripts), they are interpreted as part of the
26 ph10 279 pattern. Quotes can of course be used to delimit patterns on the command line
27     because they are interpreted by the shell, and indeed they are required if a
28 ph10 392 pattern contains white space or shell metacharacters.
29 nigel 75 .P
30 nigel 87 The first argument that follows any option settings is treated as the single
31     pattern to be matched when neither \fB-e\fP nor \fB-f\fP is present.
32     Conversely, when one or both of these options are used to specify patterns, all
33     arguments are treated as path names. At least one of \fB-e\fP, \fB-f\fP, or an
34     argument pattern must be provided.
35     .P
36 nigel 77 If no files are specified, \fBpcregrep\fP reads the standard input. The
37     standard input can also be referenced by a name consisting of a single hyphen.
38     For example:
39     .sp
40     pcregrep some-pattern /file1 - /file3
41     .sp
42 ph10 281 By default, each line that matches a pattern is copied to the standard
43 nigel 87 output, and if there is more than one file, the file name is output at the
44 ph10 279 start of each line, followed by a colon. However, there are options that can
45     change how \fBpcregrep\fP behaves. In particular, the \fB-M\fP option makes it
46     possible to search for patterns that span line boundaries. What defines a line
47     boundary is controlled by the \fB-N\fP (\fB--newline\fP) option.
48 nigel 75 .P
49 nigel 77 Patterns are limited to 8K or BUFSIZ characters, whichever is the greater.
50 ph10 286 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
52     each line in the order in which they are defined, except that all the \fB-e\fP
53 ph10 392 patterns are tried before the \fB-f\fP patterns.
54 nigel 87 .P
55 ph10 379 By default, as soon as one pattern matches (or fails to match when \fB-v\fP is
56     used), no further patterns are considered. However, if \fB--colour\fP (or
57     \fB--color\fP) is used to colour the matching substrings, or if
58     \fB--only-matching\fP, \fB--file-offsets\fP, or \fB--line-offsets\fP is used to
59     output only the part of the line that matched (either shown literally, or as an
60     offset), scanning resumes immediately following the match, so that further
61     matches on the same line can be found. If there are multiple patterns, they are
62     all tried on the remainder of the line, but patterns that follow the one that
63     matched are not tried on the earlier part of the line.
64 ph10 281 .P
65 ph10 392 This is the same behaviour as GNU grep, but it does mean that the order in
66     which multiple patterns are specified can affect the output when one of the
67 ph10 379 above options is used.
68     .P
69     Patterns that can match an empty string are accepted, but empty string
70 ph10 392 matches are not recognized. An example is the pattern "(super)?(man)?", in
71 ph10 379 which all components are optional. This pattern finds all occurrences of both
72     "super" and "man"; the output differs from matching with "super|man" when only
73     the matching substrings are being shown.
74     .P
75 nigel 87 If the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variable is set,
76     \fBpcregrep\fP uses the value to set a locale when calling the PCRE library.
77     The \fB--locale\fP option can be used to override this.
78 nigel 75 .
79 ph10 286 .SH "SUPPORT FOR COMPRESSED FILES"
80     .rs
81     .sp
82     It is possible to compile \fBpcregrep\fP so that it uses \fBlibz\fP or
83     \fBlibbz2\fP to read files whose names end in \fB.gz\fP or \fB.bz2\fP,
84     respectively. You can find out whether your binary has support for one or both
85     of these file types by running it with the \fB--help\fP option. If the
86     appropriate support is not present, files are treated as plain text. The
87     standard input is always so treated.
88     .
89 nigel 49 .SH OPTIONS
90 nigel 63 .rs
91 ph10 420 .sp
92     The order in which some of the options appear can affect the output. For
93     example, both the \fB-h\fP and \fB-l\fP options affect the printing of file
94     names. Whichever comes later in the command line will be the one that takes
95     effect.
96 nigel 49 .TP 10
97 nigel 77 \fB--\fP
98     This terminate the list of options. It is useful if the next item on the
99 nigel 87 command line starts with a hyphen but is not an option. This allows for the
100     processing of patterns and filenames that start with hyphens.
101 nigel 49 .TP
102 nigel 87 \fB-A\fP \fInumber\fP, \fB--after-context=\fP\fInumber\fP
103     Output \fInumber\fP lines of context after each matching line. If filenames
104     and/or line numbers are being output, a hyphen separator is used instead of a
105     colon for the context lines. A line containing "--" is output between each
106 nigel 77 group of lines, unless they are in fact contiguous in the input file. The value
107     of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP
108 nigel 87 guarantees to have up to 8K of following text available for context output.
109 nigel 77 .TP
110 nigel 87 \fB-B\fP \fInumber\fP, \fB--before-context=\fP\fInumber\fP
111     Output \fInumber\fP lines of context before each matching line. If filenames
112     and/or line numbers are being output, a hyphen separator is used instead of a
113     colon for the context lines. A line containing "--" is output between each
114 nigel 77 group of lines, unless they are in fact contiguous in the input file. The value
115     of \fInumber\fP is expected to be relatively small. However, \fBpcregrep\fP
116 nigel 87 guarantees to have up to 8K of preceding text available for context output.
117 nigel 77 .TP
118 nigel 87 \fB-C\fP \fInumber\fP, \fB--context=\fP\fInumber\fP
119     Output \fInumber\fP lines of context both before and after each matching line.
120 nigel 77 This is equivalent to setting both \fB-A\fP and \fB-B\fP to the same value.
121     .TP
122 nigel 87 \fB-c\fP, \fB--count\fP
123 ph10 420 Do not output individual lines from the files that are being scanned; instead
124     output the number of lines that would otherwise have been shown. If no lines
125     are selected, the number zero is output. If several files are are being
126     scanned, a count is output for each of them. However, if the
127     \fB--files-with-matches\fP option is also used, only those files whose counts
128     are greater than zero are listed. When \fB-c\fP is used, the \fB-A\fP,
129     \fB-B\fP, and \fB-C\fP options are ignored.
130 nigel 49 .TP
131 nigel 87 \fB--colour\fP, \fB--color\fP
132     If this option is given without any data, it is equivalent to "--colour=auto".
133     If data is required, it must be given in the same shell item, separated by an
134     equals sign.
135     .TP
136     \fB--colour=\fP\fIvalue\fP, \fB--color=\fP\fIvalue\fP
137 ph10 376 This option specifies under what circumstances the parts of a line that matched
138     a pattern should be coloured in the output. By default, the output is not
139     coloured. The value (which is optional, see above) may be "never", "always", or
140     "auto". In the latter case, colouring happens only if the standard output is
141 ph10 392 connected to a terminal. More resources are used when colouring is enabled,
142     because \fBpcregrep\fP has to search for all possible matches in a line, not
143 ph10 378 just one, in order to colour them all.
144    
145     The colour that is used can be specified by setting the environment variable
146     PCREGREP_COLOUR or PCREGREP_COLOR. The value of this variable should be a
147     string of two numbers, separated by a semicolon. They are copied directly into
148     the control string for setting colour on a terminal, so it is your
149     responsibility to ensure that they make sense. If neither of the environment
150     variables is set, the default is "1;31", which gives red.
151 nigel 87 .TP
152     \fB-D\fP \fIaction\fP, \fB--devices=\fP\fIaction\fP
153     If an input path is not a regular file or a directory, "action" specifies how
154     it is to be processed. Valid values are "read" (the default) or "skip"
155     (silently skip the path).
156     .TP
157     \fB-d\fP \fIaction\fP, \fB--directories=\fP\fIaction\fP
158     If an input path is a directory, "action" specifies how it is to be processed.
159     Valid values are "read" (the default), "recurse" (equivalent to the \fB-r\fP
160     option), or "skip" (silently skip the path). In the default case, directories
161     are read as if they were ordinary files. In some operating systems the effect
162     of reading a directory like this is an immediate end-of-file.
163     .TP
164 ph10 286 \fB-e\fP \fIpattern\fP, \fB--regex=\fP\fIpattern\fP, \fB--regexp=\fP\fIpattern\fP
165 ph10 279 Specify a pattern to be matched. This option can be used multiple times in
166     order to specify several patterns. It can also be used as a way of specifying a
167     single pattern that starts with a hyphen. When \fB-e\fP is used, no argument
168     pattern is taken from the command line; all arguments are treated as file
169     names. There is an overall maximum of 100 patterns. They are applied to each
170     line in the order in which they are defined until one matches (or fails to
171     match if \fB-v\fP is used). If \fB-f\fP is used with \fB-e\fP, the command line
172     patterns are matched first, followed by the patterns from the file, independent
173     of the order in which these options are specified. Note that multiple use of
174     \fB-e\fP is not the same as a single pattern with alternatives. For example,
175     X|Y finds the first character in a line that is X or Y, whereas if the two
176     patterns are given separately, \fBpcregrep\fP finds X if it is present, even if
177     it follows Y in the line. It finds Y only if there is no X in the line. This
178     really matters only if you are using \fB-o\fP to show the part(s) of the line
179     that matched.
180 nigel 87 .TP
181 nigel 77 \fB--exclude\fP=\fIpattern\fP
182     When \fBpcregrep\fP is searching the files in a directory as a consequence of
183 ph10 324 the \fB-r\fP (recursive search) option, any regular files whose names match the
184 ph10 325 pattern are excluded. Subdirectories are not excluded by this option; they are
185     searched recursively, subject to the \fB--exclude_dir\fP and
186     \fB--include_dir\fP options. The pattern is a PCRE regular expression, and is
187     matched against the final component of the file name (not the entire path). If
188     a file name matches both \fB--include\fP and \fB--exclude\fP, it is excluded.
189     There is no short form for this option.
190 nigel 77 .TP
191 ph10 325 \fB--exclude_dir\fP=\fIpattern\fP
192     When \fBpcregrep\fP is searching the contents of a directory as a consequence
193     of the \fB-r\fP (recursive search) option, any subdirectories whose names match
194     the pattern are excluded. (Note that the \fP--exclude\fP option does not affect
195     subdirectories.) The pattern is a PCRE regular expression, and is matched
196     against the final component of the name (not the entire path). If a
197     subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
198     is excluded. There is no short form for this option.
199     .TP
200 nigel 87 \fB-F\fP, \fB--fixed-strings\fP
201     Interpret each pattern as a list of fixed strings, separated by newlines,
202     instead of as a regular expression. The \fB-w\fP (match as a word) and \fB-x\fP
203     (match whole line) options can be used with \fB-F\fP. They apply to each of the
204     fixed strings. A line is selected if any of the fixed strings are found in it
205     (subject to \fB-w\fP or \fB-x\fP, if present).
206 nigel 53 .TP
207 nigel 87 \fB-f\fP \fIfilename\fP, \fB--file=\fP\fIfilename\fP
208     Read a number of patterns from the file, one per line, and match them against
209     each line of input. A data line is output if any of the patterns match it. The
210     filename can be given as "-" to refer to the standard input. When \fB-f\fP is
211     used, patterns specified on the command line using \fB-e\fP may also be
212     present; they are tested before the file's patterns. However, no other pattern
213     is taken from the command line; all arguments are treated as file names. There
214     is an overall maximum of 100 patterns. Trailing white space is removed from
215     each line, and blank lines are ignored. An empty file contains no patterns and
216 ph10 286 therefore matches nothing. See also the comments about multiple patterns versus
217 ph10 281 a single pattern with alternatives in the description of \fB-e\fP above.
218 nigel 49 .TP
219 ph10 280 \fB--file-offsets\fP
220     Instead of showing lines or parts of lines that match, show each match as an
221     offset from the start of the file and a length, separated by a comma. In this
222     mode, no context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP
223     options are ignored. If there is more than one match in a line, each of them is
224     shown separately. This option is mutually exclusive with \fB--line-offsets\fP
225     and \fB--only-matching\fP.
226     .TP
227 nigel 87 \fB-H\fP, \fB--with-filename\fP
228     Force the inclusion of the filename at the start of output lines when searching
229     a single file. By default, the filename is not shown in this case. For matching
230 ph10 376 lines, the filename is followed by a colon; for context lines, a hyphen
231     separator is used. If a line number is also being output, it follows the file
232     name.
233 nigel 87 .TP
234     \fB-h\fP, \fB--no-filename\fP
235     Suppress the output filenames when searching multiple files. By default,
236     filenames are shown when multiple files are searched. For matching lines, the
237 ph10 376 filename is followed by a colon; for context lines, a hyphen separator is used.
238     If a line number is also being output, it follows the file name.
239 nigel 87 .TP
240     \fB--help\fP
241 ph10 286 Output a help message, giving brief details of the command options and file
242     type support, and then exit.
243 nigel 87 .TP
244     \fB-i\fP, \fB--ignore-case\fP
245 nigel 49 Ignore upper/lower case distinctions during comparisons.
246     .TP
247 nigel 77 \fB--include\fP=\fIpattern\fP
248     When \fBpcregrep\fP is searching the files in a directory as a consequence of
249 ph10 324 the \fB-r\fP (recursive search) option, only those regular files whose names
250 ph10 325 match the pattern are included. Subdirectories are always included and searched
251     recursively, subject to the \fP--include_dir\fP and \fB--exclude_dir\fP
252     options. The pattern is a PCRE regular expression, and is matched against the
253     final component of the file name (not the entire path). If a file name matches
254     both \fB--include\fP and \fB--exclude\fP, it is excluded. There is no short
255     form for this option.
256 nigel 77 .TP
257 ph10 325 \fB--include_dir\fP=\fIpattern\fP
258     When \fBpcregrep\fP is searching the contents of a directory as a consequence
259     of the \fB-r\fP (recursive search) option, only those subdirectories whose
260     names match the pattern are included. (Note that the \fB--include\fP option
261     does not affect subdirectories.) The pattern is a PCRE regular expression, and
262     is matched against the final component of the name (not the entire path). If a
263     subdirectory name matches both \fB--include_dir\fP and \fB--exclude_dir\fP, it
264     is excluded. There is no short form for this option.
265     .TP
266 nigel 87 \fB-L\fP, \fB--files-without-match\fP
267     Instead of outputting lines from the files, just output the names of the files
268     that do not contain any lines that would have been output. Each file name is
269     output once, on a separate line.
270 nigel 77 .TP
271 nigel 87 \fB-l\fP, \fB--files-with-matches\fP
272     Instead of outputting lines from the files, just output the names of the files
273     containing lines that would have been output. Each file name is output
274 ph10 420 once, on a separate line. Searching normally stops as soon as a matching line
275     is found in a file. However, if the \fB-c\fP (count) option is also used,
276     matching continues in order to obtain the correct count, and those files that
277     have at least one match are listed along with their counts. Using this option
278     with \fB-c\fP is a way of suppressing the listing of files with no matches.
279 nigel 49 .TP
280 nigel 77 \fB--label\fP=\fIname\fP
281     This option supplies a name to be used for the standard input when file names
282 nigel 87 are being output. If not supplied, "(standard input)" is used. There is no
283 nigel 77 short form for this option.
284     .TP
285 ph10 280 \fB--line-offsets\fP
286 ph10 286 Instead of showing lines or parts of lines that match, show each match as a
287     line number, the offset from the start of the line, and a length. The line
288     number is terminated by a colon (as usual; see the \fB-n\fP option), and the
289 ph10 280 offset and length are separated by a comma. In this mode, no context is shown.
290     That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are ignored. If there is
291     more than one match in a line, each of them is shown separately. This option is
292     mutually exclusive with \fB--file-offsets\fP and \fB--only-matching\fP.
293     .TP
294 nigel 87 \fB--locale\fP=\fIlocale-name\fP
295     This option specifies a locale to be used for pattern matching. It overrides
296     the value in the \fBLC_ALL\fP or \fBLC_CTYPE\fP environment variables. If no
297     locale is specified, the PCRE library's default (usually the "C" locale) is
298     used. There is no short form for this option.
299     .TP
300     \fB-M\fP, \fB--multiline\fP
301 nigel 77 Allow patterns to match more than one line. When this option is given, patterns
302     may usefully contain literal newline characters and internal occurrences of ^
303     and $ characters. The output for any one match may consist of more than one
304     line. When this option is set, the PCRE library is called in "multiline" mode.
305     There is a limit to the number of lines that can be matched, imposed by the way
306     that \fBpcregrep\fP buffers the input file as it scans it. However,
307     \fBpcregrep\fP ensures that at least 8K characters or the rest of the document
308     (whichever is the shorter) are available for forward matching, and similarly
309     the previous 8K characters (or all the previous characters, if fewer than 8K)
310     are guaranteed to be available for lookbehind assertions.
311     .TP
312 nigel 91 \fB-N\fP \fInewline-type\fP, \fB--newline=\fP\fInewline-type\fP
313 ph10 149 The PCRE library supports five different conventions for indicating
314 nigel 91 the ends of lines. They are the single-character sequences CR (carriage return)
315 ph10 150 and LF (linefeed), the two-character sequence CRLF, an "anycrlf" convention,
316 ph10 149 which recognizes any of the preceding three types, and an "any" convention, in
317 nigel 93 which any Unicode line ending sequence is assumed to end a line. The Unicode
318     sequences are the three just mentioned, plus VT (vertical tab, U+000B), FF
319     (formfeed, U+000C), NEL (next line, U+0085), LS (line separator, U+2028), and
320 ph10 149 PS (paragraph separator, U+2029).
321 nigel 93 .sp
322     When the PCRE library is built, a default line-ending sequence is specified.
323     This is normally the standard sequence for the operating system. Unless
324     otherwise specified by this option, \fBpcregrep\fP uses the library's default.
325 ph10 149 The possible values for this option are CR, LF, CRLF, ANYCRLF, or ANY. This
326     makes it possible to use \fBpcregrep\fP on files that have come from other
327     environments without having to modify their line endings. If the data that is
328     being scanned does not agree with the convention set by this option,
329     \fBpcregrep\fP may behave in strange ways.
330 nigel 91 .TP
331 nigel 87 \fB-n\fP, \fB--line-number\fP
332     Precede each output line by its line number in the file, followed by a colon
333 ph10 376 for matching lines or a hyphen for context lines. If the filename is also being
334     output, it precedes the line number. This option is forced if
335     \fB--line-offsets\fP is used.
336 nigel 49 .TP
337 nigel 87 \fB-o\fP, \fB--only-matching\fP
338     Show only the part of the line that matched a pattern. In this mode, no
339     context is shown. That is, the \fB-A\fP, \fB-B\fP, and \fB-C\fP options are
340 ph10 286 ignored. If there is more than one match in a line, each of them is shown
341     separately. If \fB-o\fP is combined with \fB-v\fP (invert the sense of the
342     match to find non-matching lines), no output is generated, but the return code
343     is set appropriately. This option is mutually exclusive with
344 ph10 280 \fB--file-offsets\fP and \fB--line-offsets\fP.
345 nigel 77 .TP
346 nigel 87 \fB-q\fP, \fB--quiet\fP
347     Work quietly, that is, display nothing except error messages. The exit
348     status indicates whether or not any matches were found.
349     .TP
350     \fB-r\fP, \fB--recursive\fP
351 nigel 77 If any given path is a directory, recursively scan the files it contains,
352 nigel 87 taking note of any \fB--include\fP and \fB--exclude\fP settings. By default, a
353     directory is read as a normal file; in some operating systems this gives an
354     immediate end-of-file. This option is a shorthand for setting the \fB-d\fP
355     option to "recurse".
356 nigel 53 .TP
357 nigel 87 \fB-s\fP, \fB--no-messages\fP
358 nigel 77 Suppress error messages about non-existent or unreadable files. Such files are
359     quietly skipped. However, the return code is still 2, even if matches were
360     found in other files.
361 nigel 49 .TP
362 nigel 87 \fB-u\fP, \fB--utf-8\fP
363 nigel 63 Operate in UTF-8 mode. This option is available only if PCRE has been compiled
364 nigel 87 with UTF-8 support. Both patterns and subject lines must be valid strings of
365     UTF-8 characters.
366 nigel 63 .TP
367 nigel 87 \fB-V\fP, \fB--version\fP
368 nigel 77 Write the version numbers of \fBpcregrep\fP and the PCRE library that is being
369     used to the standard error stream.
370     .TP
371 nigel 87 \fB-v\fP, \fB--invert-match\fP
372     Invert the sense of the match, so that lines which do \fInot\fP match any of
373     the patterns are the ones that are found.
374 nigel 49 .TP
375 nigel 87 \fB-w\fP, \fB--word-regex\fP, \fB--word-regexp\fP
376     Force the patterns to match only whole words. This is equivalent to having \eb
377 nigel 77 at the start and end of the pattern.
378     .TP
379 ph10 148 \fB-x\fP, \fB--line-regex\fP, \fB--line-regexp\fP
380 nigel 87 Force the patterns to be anchored (each must start matching at the beginning of
381     a line) and in addition, require them to match entire lines. This is
382 nigel 49 equivalent to having ^ and $ characters at the start and end of each
383 nigel 87 alternative branch in every pattern.
384 nigel 75 .
385 nigel 87 .
386     .SH "ENVIRONMENT VARIABLES"
387 nigel 63 .rs
388     .sp
389 nigel 87 The environment variables \fBLC_ALL\fP and \fBLC_CTYPE\fP are examined, in that
390     order, for a locale. The first one that is set is used. This can be overridden
391     by the \fB--locale\fP option. If no locale is set, the PCRE library's default
392     (usually the "C" locale) is used.
393     .
394     .
395 nigel 91 .SH "NEWLINES"
396     .rs
397     .sp
398     The \fB-N\fP (\fB--newline\fP) option allows \fBpcregrep\fP to scan files with
399     different newline conventions from the default. However, the setting of this
400     option does not affect the way in which \fBpcregrep\fP writes information to
401     the standard error and output streams. It uses the string "\en" in C
402     \fBprintf()\fP calls to indicate newlines, relying on the C I/O library to
403     convert this to an appropriate sequence if the output is sent to a file.
404     .
405     .
406 nigel 87 .SH "OPTIONS COMPATIBILITY"
407     .rs
408 nigel 75 .sp
409 nigel 87 The majority of short and long forms of \fBpcregrep\fP's options are the same
410     as in the GNU \fBgrep\fP program. Any long option of the form
411     \fB--xxx-regexp\fP (GNU terminology) is also available as \fB--xxx-regex\fP
412     (PCRE terminology). However, the \fB--locale\fP, \fB-M\fP, \fB--multiline\fP,
413 ph10 420 \fB-u\fP, and \fB--utf-8\fP options are specific to \fBpcregrep\fP. If both the
414     \fB-c\fP and \fB-l\fP options are given, GNU grep lists only file names,
415     without counts, but \fBpcregrep\fP gives the counts.
416 nigel 77 .
417 nigel 87 .
418 nigel 77 .SH "OPTIONS WITH DATA"
419     .rs
420 nigel 75 .sp
421 nigel 77 There are four different ways in which an option with data can be specified.
422     If a short form option is used, the data may follow immediately, or in the next
423     command line item. For example:
424     .sp
425     -f/some/file
426     -f /some/file
427     .sp
428     If a long form option is used, the data may appear in the same command line
429 nigel 87 item, separated by an equals character, or (with one exception) it may appear
430     in the next command line item. For example:
431 nigel 77 .sp
432     --file=/some/file
433     --file /some/file
434     .sp
435 nigel 87 Note, however, that if you want to supply a file name beginning with ~ as data
436     in a shell command, and have the shell expand ~ to a home directory, you must
437     separate the file name from the option, because the shell does not treat ~
438     specially unless it is at the start of an item.
439     .P
440     The exception to the above is the \fB--colour\fP (or \fB--color\fP) option,
441     for which the data is optional. If this option does have data, it must be given
442     in the first form, using an equals character. Otherwise it will be assumed that
443     it has no data.
444 nigel 75 .
445 nigel 87 .
446 nigel 93 .SH "MATCHING ERRORS"
447 nigel 87 .rs
448     .sp
449     It is possible to supply a regular expression that takes a very long time to
450     fail to match certain lines. Such patterns normally involve nested indefinite
451     repeats, for example: (a+)*\ed when matched against a line of a's with no final
452     digit. The PCRE matching function has a resource limit that causes it to abort
453     in these circumstances. If this happens, \fBpcregrep\fP outputs an error
454     message and the line that caused the problem to the standard error stream. If
455     there are more than 20 such errors, \fBpcregrep\fP gives up.
456     .
457     .
458 nigel 49 .SH DIAGNOSTICS
459 nigel 63 .rs
460     .sp
461 nigel 49 Exit status is 0 if any matches were found, 1 if no matches were found, and 2
462 nigel 77 for syntax errors and non-existent or inacessible files (even if matches were
463 nigel 87 found in other files) or too many matching errors. Using the \fB-s\fP option to
464     suppress error messages about inaccessble files does not affect the return
465     code.
466 nigel 75 .
467     .
468 nigel 93 .SH "SEE ALSO"
469     .rs
470     .sp
471     \fBpcrepattern\fP(3), \fBpcretest\fP(1).
472     .
473     .
474 nigel 49 .SH AUTHOR
475 nigel 63 .rs
476     .sp
477 ph10 99 .nf
478 nigel 77 Philip Hazel
479 nigel 63 University Computing Service
480 nigel 93 Cambridge CB2 3QH, England.
481 ph10 99 .fi
482     .
483     .
484     .SH REVISION
485     .rs
486     .sp
487     .nf
488 ph10 420 Last updated: 12 August 2009
489 ph10 376 Copyright (c) 1997-2009 University of Cambridge.
490 ph10 99 .fi

Properties

Name Value
svn:eol-style native
svn:keywords "Author Date Id Revision Url"

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12