ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 75 - (show annotations)
Sat Feb 24 21:40:37 2007 UTC (13 years, 9 months ago) by nigel
File MIME type: text/html
File size: 5143 byte(s)
Error occurred while calculating annotation data.
Load pcre-5.0 into code/trunk.
1 <html>
2 <head>
3 <title>pcregrep specification</title>
4 </head>
5 <body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6 <h1>pcregrep man page</h1>
7 <p>
8 Return to the <a href="index.html">PCRE index page</a>.
9 </p>
10 <p>
11 This page is part of the PCRE HTML documentation. It was generated automatically
12 from the original man page. If there is any nonsense in it, please consult the
13 man page, in case the conversion went wrong.
14 <br>
15 <ul>
16 <li><a name="TOC1" href="#SEC1">SYNOPSIS</a>
17 <li><a name="TOC2" href="#SEC2">DESCRIPTION</a>
18 <li><a name="TOC3" href="#SEC3">OPTIONS</a>
19 <li><a name="TOC4" href="#SEC4">LONG OPTIONS</a>
20 <li><a name="TOC5" href="#SEC5">DIAGNOSTICS</a>
21 <li><a name="TOC6" href="#SEC6">AUTHOR</a>
22 </ul>
23 <br><a name="SEC1" href="#TOC1">SYNOPSIS</a><br>
24 <P>
25 <b>pcregrep [-Vcfhilnrsuvx] [long options] [pattern] [file1 file2 ...]</b>
26 </P>
27 <br><a name="SEC2" href="#TOC1">DESCRIPTION</a><br>
28 <P>
29 <b>pcregrep</b> searches files for character patterns, in the same way as other
30 grep commands do, but it uses the PCRE regular expression library to support
31 patterns that are compatible with the regular expressions of Perl 5. See
32 <a href="pcrepattern.html"><b>pcrepattern</b></a>
33 for a full description of syntax and semantics of the regular expressions that
34 PCRE supports.
35 </P>
36 <P>
37 A pattern must be specified on the command line unless the <b>-f</b> option is
38 used (see below).
39 </P>
40 <P>
41 If no files are specified, <b>pcregrep</b> reads the standard input. By default,
42 each line that matches the pattern is copied to the standard output, and if
43 there is more than one file, the file name is printed before each line of
44 output. However, there are options that can change how <b>pcregrep</b> behaves.
45 </P>
46 <P>
47 Lines are limited to BUFSIZ characters. BUFSIZ is defined in <b>&#60;stdio.h&#62;</b>.
48 The newline character is removed from the end of each line before it is matched
49 against the pattern.
50 </P>
51 <br><a name="SEC3" href="#TOC1">OPTIONS</a><br>
52 <P>
53 <b>-V</b>
54 Write the version number of the PCRE library being used to the standard error
55 stream.
56 </P>
57 <P>
58 <b>-c</b>
59 Do not print individual lines; instead just print a count of the number of
60 lines that would otherwise have been printed. If several files are given, a
61 count is printed for each of them.
62 </P>
63 <P>
64 <b>-f</b><i>filename</i>
65 Read a number of patterns from the file, one per line, and match all of them
66 against each line of input. A line is output if any of the patterns match it.
67 When <b>-f</b> is used, no pattern is taken from the command line; all arguments
68 are treated as file names. There is a maximum of 100 patterns. Trailing white
69 space is removed, and blank lines are ignored. An empty file contains no
70 patterns and therefore matches nothing.
71 </P>
72 <P>
73 <b>-h</b>
74 Suppress printing of filenames when searching multiple files.
75 </P>
76 <P>
77 <b>-i</b>
78 Ignore upper/lower case distinctions during comparisons.
79 </P>
80 <P>
81 <b>-l</b>
82 Instead of printing lines from the files, just print the names of the files
83 containing lines that would have been printed. Each file name is printed
84 once, on a separate line.
85 </P>
86 <P>
87 <b>-n</b>
88 Precede each line by its line number in the file.
89 </P>
90 <P>
91 <b>-r</b>
92 If any file is a directory, recursively scan the files it contains. Without
93 <b>-r</b> a directory is scanned as a normal file.
94 </P>
95 <P>
96 <b>-s</b>
97 Work silently, that is, display nothing except error messages.
98 The exit status indicates whether any matches were found.
99 </P>
100 <P>
101 <b>-u</b>
102 Operate in UTF-8 mode. This option is available only if PCRE has been compiled
103 with UTF-8 support. Both the pattern and each subject line must be valid
104 strings of UTF-8 characters.
105 </P>
106 <P>
107 <b>-v</b>
108 Invert the sense of the match, so that lines which do <i>not</i> match the
109 pattern are now the ones that are found.
110 </P>
111 <P>
112 <b>-x</b>
113 Force the pattern to be anchored (it must start matching at the beginning of
114 the line) and in addition, require it to match the entire line. This is
115 equivalent to having ^ and $ characters at the start and end of each
116 alternative branch in the regular expression.
117 </P>
118 <br><a name="SEC4" href="#TOC1">LONG OPTIONS</a><br>
119 <P>
120 Long forms of all the options are available, as in GNU grep. They are shown in
121 the following table:
122 <pre>
123 -c --count
124 -h --no-filename
125 -i --ignore-case
126 -l --files-with-matches
127 -n --line-number
128 -r --recursive
129 -s --no-messages
130 -u --utf-8
131 -V --version
132 -v --invert-match
133 -x --line-regex
134 -x --line-regexp
135 </pre>
136 In addition, --file=<i>filename</i> is equivalent to -f<i>filename</i>, and
137 --help shows the list of options and then exits.
138 </P>
139 <br><a name="SEC5" href="#TOC1">DIAGNOSTICS</a><br>
140 <P>
141 Exit status is 0 if any matches were found, 1 if no matches were found, and 2
142 for syntax errors or inacessible files (even if matches were found).
143 </P>
144 <br><a name="SEC6" href="#TOC1">AUTHOR</a><br>
145 <P>
146 Philip Hazel &#60;ph10@cam.ac.uk&#62;
147 <br>
148 University Computing Service
149 <br>
150 Cambridge CB2 3QG, England.
151 </P>
152 <P>
153 Last updated: 09 September 2004
154 <br>
155 Copyright &copy; 1997-2004 University of Cambridge.
156 <p>
157 Return to the <a href="index.html">PCRE index page</a>.
158 </p>

  ViewVC Help
Powered by ViewVC 1.1.5