/[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 74 by nigel, Sat Feb 24 21:40:03 2007 UTC revision 75 by nigel, Sat Feb 24 21:40:37 2007 UTC
# Line 3  Line 3 
3  pcregrep - a grep with Perl-compatible regular expressions.  pcregrep - a grep with Perl-compatible regular expressions.
4  .SH SYNOPSIS  .SH SYNOPSIS
5  .B pcregrep [-Vcfhilnrsuvx] [long options] [pattern] [file1 file2 ...]  .B pcregrep [-Vcfhilnrsuvx] [long options] [pattern] [file1 file2 ...]
6    .
7  .SH DESCRIPTION  .SH DESCRIPTION
8  .rs  .rs
9  .sp  .sp
10  \fBpcregrep\fR searches files for character patterns, in the same way as other  \fBpcregrep\fP searches files for character patterns, in the same way as other
11  grep commands do, but it uses the PCRE regular expression library to support  grep commands do, but it uses the PCRE regular expression library to support
12  patterns that are compatible with the regular expressions of Perl 5. See  patterns that are compatible with the regular expressions of Perl 5. See
13  .\" HREF  .\" HREF
14  \fBpcrepattern\fR  \fBpcrepattern\fP
15  .\"  .\"
16  for a full description of syntax and semantics of the regular expressions that  for a full description of syntax and semantics of the regular expressions that
17  PCRE supports.  PCRE supports.
18    .P
19  A pattern must be specified on the command line unless the \fB-f\fR option is  A pattern must be specified on the command line unless the \fB-f\fP option is
20  used (see below).  used (see below).
21    .P
22  If no files are specified, \fBpcregrep\fR reads the standard input. By default,  If no files are specified, \fBpcregrep\fP reads the standard input. By default,
23  each line that matches the pattern is copied to the standard output, and if  each line that matches the pattern is copied to the standard output, and if
24  there is more than one file, the file name is printed before each line of  there is more than one file, the file name is printed before each line of
25  output. However, there are options that can change how \fBpcregrep\fR behaves.  output. However, there are options that can change how \fBpcregrep\fP behaves.
26    .P
27  Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB<stdio.h>\fR.  Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB<stdio.h>\fP.
28  The newline character is removed from the end of each line before it is matched  The newline character is removed from the end of each line before it is matched
29  against the pattern.  against the pattern.
30    .
31  .SH OPTIONS  .SH OPTIONS
32  .rs  .rs
33  .sp  .sp
34  .TP 10  .TP 10
35  \fB-V\fR  \fB-V\fP
36  Write the version number of the PCRE library being used to the standard error  Write the version number of the PCRE library being used to the standard error
37  stream.  stream.
38  .TP  .TP
39  \fB-c\fR  \fB-c\fP
40  Do not print individual lines; instead just print a count of the number of  Do not print individual lines; instead just print a count of the number of
41  lines that would otherwise have been printed. If several files are given, a  lines that would otherwise have been printed. If several files are given, a
42  count is printed for each of them.  count is printed for each of them.
43  .TP  .TP
44  \fB-f\fR\fIfilename\fR  \fB-f\fP\fIfilename\fP
45  Read a number of patterns from the file, one per line, and match all of them  Read a number of patterns from the file, one per line, and match all of them
46  against each line of input. A line is output if any of the patterns match it.  against each line of input. A line is output if any of the patterns match it.
47  When \fB-f\fR is used, no pattern is taken from the command line; all arguments  When \fB-f\fP is used, no pattern is taken from the command line; all arguments
48  are treated as file names. There is a maximum of 100 patterns. Trailing white  are treated as file names. There is a maximum of 100 patterns. Trailing white
49  space is removed, and blank lines are ignored. An empty file contains no  space is removed, and blank lines are ignored. An empty file contains no
50  patterns and therefore matches nothing.  patterns and therefore matches nothing.
51  .TP  .TP
52  \fB-h\fR  \fB-h\fP
53  Suppress printing of filenames when searching multiple files.  Suppress printing of filenames when searching multiple files.
54  .TP  .TP
55  \fB-i\fR  \fB-i\fP
56  Ignore upper/lower case distinctions during comparisons.  Ignore upper/lower case distinctions during comparisons.
57  .TP  .TP
58  \fB-l\fR  \fB-l\fP
59  Instead of printing lines from the files, just print the names of the files  Instead of printing lines from the files, just print the names of the files
60  containing lines that would have been printed. Each file name is printed  containing lines that would have been printed. Each file name is printed
61  once, on a separate line.  once, on a separate line.
62  .TP  .TP
63  \fB-n\fR  \fB-n\fP
64  Precede each line by its line number in the file.  Precede each line by its line number in the file.
65  .TP  .TP
66  \fB-r\fR  \fB-r\fP
67  If any file is a directory, recursively scan the files it contains. Without  If any file is a directory, recursively scan the files it contains. Without
68  \fB-r\fR a directory is scanned as a normal file.  \fB-r\fP a directory is scanned as a normal file.
69  .TP  .TP
70  \fB-s\fR  \fB-s\fP
71  Work silently, that is, display nothing except error messages.  Work silently, that is, display nothing except error messages.
72  The exit status indicates whether any matches were found.  The exit status indicates whether any matches were found.
73  .TP  .TP
74  \fB-u\fR  \fB-u\fP
75  Operate in UTF-8 mode. This option is available only if PCRE has been compiled  Operate in UTF-8 mode. This option is available only if PCRE has been compiled
76  with UTF-8 support. Both the pattern and each subject line are assumed to be  with UTF-8 support. Both the pattern and each subject line must be valid
77  valid strings of UTF-8 characters.  strings of UTF-8 characters.
78  .TP  .TP
79  \fB-v\fR  \fB-v\fP
80  Invert the sense of the match, so that lines which do \fInot\fR match the  Invert the sense of the match, so that lines which do \fInot\fP match the
81  pattern are now the ones that are found.  pattern are now the ones that are found.
82  .TP  .TP
83  \fB-x\fR  \fB-x\fP
84  Force the pattern to be anchored (it must start matching at the beginning of  Force the pattern to be anchored (it must start matching at the beginning of
85  the line) and in addition, require it to match the entire line. This is  the line) and in addition, require it to match the entire line. This is
86  equivalent to having ^ and $ characters at the start and end of each  equivalent to having ^ and $ characters at the start and end of each
87  alternative branch in the regular expression.  alternative branch in the regular expression.
88    .
89  .SH LONG OPTIONS  .SH "LONG OPTIONS"
90  .rs  .rs
91  .sp  .sp
92  Long forms of all the options are available, as in GNU grep. They are shown in  Long forms of all the options are available, as in GNU grep. They are shown in
93  the following table:  the following table:
94    .sp
95    -c   --count    -c   --count
96    -h   --no-filename    -h   --no-filename
97    -i   --ignore-case    -i   --ignore-case
# Line 104  the following table: Line 104  the following table:
104    -v   --invert-match    -v   --invert-match
105    -x   --line-regex    -x   --line-regex
106    -x   --line-regexp    -x   --line-regexp
107    .sp
108  In addition, --file=\fIfilename\fR is equivalent to -f\fIfilename\fR, and  In addition, --file=\fIfilename\fP is equivalent to -f\fIfilename\fP, and
109  --help shows the list of options and then exits.  --help shows the list of options and then exits.
110    .
111  .SH DIAGNOSTICS  .SH DIAGNOSTICS
112  .rs  .rs
113  .sp  .sp
114  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
115  for syntax errors or inacessible files (even if matches were found).  for syntax errors or inacessible files (even if matches were found).
116    .
117    .
118  .SH AUTHOR  .SH AUTHOR
119  .rs  .rs
120  .sp  .sp
# Line 123  Philip Hazel Line 123  Philip Hazel
123  University Computing Service  University Computing Service
124  .br  .br
125  Cambridge CB2 3QG, England.  Cambridge CB2 3QG, England.
126    .P
127  .in 0  .in 0
128  Last updated: 03 February 2003  Last updated: 09 September 2004
129  .br  .br
130  Copyright (c) 1997-2003 University of Cambridge.  Copyright (c) 1997-2004 University of Cambridge.

Legend:
Removed from v.74  
changed lines
  Added in v.75

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12