1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
<!-- manual page source format generated by PolyglotMan v3.2, -->
<!-- available at http://polyglotman.sourceforge.net/ -->
<html>
<head>
<title>PCREGREP(1) manual page</title>
</head>
<body bgcolor='white'>
<a href='#toc'>Table of Contents</a><p>
<h2><a name='sect0' href='#toc0'>Name</a></h2>
pcregrep - a grep with Perl-compatible regular expressions.
<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
<b>pcregrep
[-Vcfhilnrsuvx] [long options] [pattern] [file1 file2 ...]</b>
<h2><a name='sect2' href='#toc2'>Description</a></h2>
<p>
<b>pcregrep</b>
searches files for character patterns, in the same way as other grep commands
do, but it uses the PCRE regular expression library to support patterns
that are compatible with the regular expressions of Perl 5. See <b>pcrepattern</b>
for a full description of syntax and semantics of the regular expressions
that PCRE supports. <p>
A pattern must be specified on the command line unless
the <b>-f</b> option is used (see below). <p>
If no files are specified, <b>pcregrep</b> reads
the standard input. By default, each line that matches the pattern is copied
to the standard output, and if there is more than one file, the file name
is printed before each line of output. However, there are options that can
change how <b>pcregrep</b> behaves. <p>
Lines are limited to BUFSIZ characters. BUFSIZ
is defined in <b><stdio.h></b>. The newline character is removed from the end of each
line before it is matched against the pattern.
<h2><a name='sect3' href='#toc3'>Options</a></h2>
<p>
<dl>
<dt><b>-V</b> </dt>
<dd>Write the version
number of the PCRE library being used to the standard error stream. </dd>
<dt><b>-c</b> </dt>
<dd>Do
not print individual lines; instead just print a count of the number of
lines that would otherwise have been printed. If several files are given,
a count is printed for each of them. </dd>
<dt><b>-f</b><i>filename</i> </dt>
<dd>Read a number of patterns
from the file, one per line, and match all of them against each line of
input. A line is output if any of the patterns match it. When <b>-f</b> is used,
no pattern is taken from the command line; all arguments are treated as
file names. There is a maximum of 100 patterns. Trailing white space is removed,
and blank lines are ignored. An empty file contains no patterns and therefore
matches nothing. </dd>
<dt><b>-h</b> </dt>
<dd>Suppress printing of filenames when searching multiple
files. </dd>
<dt><b>-i</b> </dt>
<dd>Ignore upper/lower case distinctions during comparisons. </dd>
<dt><b>-l</b> </dt>
<dd>Instead
of printing lines from the files, just print the names of the files containing
lines that would have been printed. Each file name is printed once, on a
separate line. </dd>
<dt><b>-n</b> </dt>
<dd>Precede each line by its line number in the file. </dd>
<dt><b>-r</b> </dt>
<dd>If any
file is a directory, recursively scan the files it contains. Without <b>-r</b> a
directory is scanned as a normal file. </dd>
<dt><b>-s</b> </dt>
<dd>Work silently, that is, display
nothing except error messages. The exit status indicates whether any matches
were found. </dd>
<dt><b>-u</b> </dt>
<dd>Operate in UTF-8 mode. This option is available only if PCRE
has been compiled with UTF-8 support. Both the pattern and each subject line
must be valid strings of UTF-8 characters. </dd>
<dt><b>-v</b> </dt>
<dd>Invert the sense of the match,
so that lines which do <i>not</i> match the pattern are now the ones that are
found. </dd>
<dt><b>-x</b> </dt>
<dd>Force the pattern to be anchored (it must start matching at the
beginning of the line) and in addition, require it to match the entire
line. This is equivalent to having ^ and $ characters at the start and end
of each alternative branch in the regular expression. </dd>
</dl>
<h2><a name='sect4' href='#toc4'>Long Options</a></h2>
<p>
Long
forms of all the options are available, as in GNU grep. They are shown in
the following table: <p>
-c --count<br>
-h --no-filename<br>
-i --ignore-case<br>
-l --files-with-matches<br>
-n --line-number<br>
-r --recursive<br>
-s --no-messages<br>
-u --utf-8<br>
-V --version<br>
-v --invert-match<br>
-x --line-regex<br>
-x --line-regexp<br>
<p>
In addition, --file=<i>filename</i> is equivalent to -f<i>filename</i>, and --help shows
the list of options and then exits.
<h2><a name='sect5' href='#toc5'>Diagnostics</a></h2>
<p>
Exit status is 0 if any
matches were found, 1 if no matches were found, and 2 for syntax errors
or inacessible files (even if matches were found).
<h2><a name='sect6' href='#toc6'>Author</a></h2>
<p>
Philip Hazel
<ph10@cam.ac.uk> <br>
University Computing Service <br>
Cambridge CB2 3QG, England. <p>
Last updated: 09 September 2004 <br>
Copyright (c) 1997-2004 University of Cambridge. <p>
<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Options</a></li>
<li><a name='toc4' href='#sect4'>Long Options</a></li>
<li><a name='toc5' href='#sect5'>Diagnostics</a></li>
<li><a name='toc6' href='#sect6'>Author</a></li>
</ul>
</body>
</html>
|