2 |
pcregrep - a grep with Perl-compatible regular expressions. |
pcregrep - a grep with Perl-compatible regular expressions. |
3 |
|
|
4 |
|
|
|
|
|
5 |
SYNOPSIS |
SYNOPSIS |
6 |
pcregrep [-Vcfhilnrsvx] pattern [file] ... |
pcregrep [-Vcfhilnrsuvx] [long options] [pattern] [file1 |
|
|
|
7 |
|
|
8 |
|
|
9 |
DESCRIPTION |
DESCRIPTION |
10 |
|
|
11 |
pcregrep searches files for character patterns, in the same |
pcregrep searches files for character patterns, in the same |
12 |
way as other grep commands do, but it uses the PCRE regular |
way as other grep commands do, but it uses the PCRE regular |
13 |
expression library to support patterns that are compatible |
expression library to support patterns that are compatible |
14 |
with the regular expressions of Perl 5. See pcre(3) for a |
with the regular expressions of Perl 5. See pcrepattern for |
15 |
full description of syntax and semantics. |
a full description of syntax and semantics of the regular |
16 |
|
expressions that PCRE supports. |
17 |
|
|
18 |
|
A pattern must be specified on the command line unless the |
19 |
|
-f option is used (see below). |
20 |
|
|
21 |
If no files are specified, pcregrep reads the standard |
If no files are specified, pcregrep reads the standard |
22 |
input. By default, each line that matches the pattern is |
input. By default, each line that matches the pattern is |
30 |
each line before it is matched against the pattern. |
each line before it is matched against the pattern. |
31 |
|
|
32 |
|
|
|
|
|
33 |
OPTIONS |
OPTIONS |
34 |
|
|
35 |
|
|
36 |
-V Write the version number of the PCRE library being |
-V Write the version number of the PCRE library being |
37 |
used to the standard error stream. |
used to the standard error stream. |
38 |
|
|
41 |
wise have been printed. If several files are |
wise have been printed. If several files are |
42 |
given, a count is printed for each of them. |
given, a count is printed for each of them. |
43 |
|
|
44 |
versity of Cambridge for use on Unix systems connected to |
-ffilename |
45 |
the Internet. It is freely available |
Read a number of patterns from the file, one per |
46 |
under the terms of |
line, and match all of them against each line of |
47 |
the GNU General Public Licence. In style it |
input. A line is output if any of the patterns |
48 |
is similar to |
match it. When -f is used, no pattern is taken |
49 |
Smail 3, but its facilities are more |
from the command line; all arguments are treated |
50 |
extensive, and in |
as file names. There is a maximum of 100 patterns. |
|
particular it has some defences against |
|
|
mail bombs and |
|
|
unsolicited junk mail, in the form of |
|
|
options for refusing |
|
|
messages from particular hosts, networks, |
|
|
or senders. |
|
|
|
|
|
Exim's command line takes the standard |
|
|
|
|
|
Unix form of a |
|
|
sequence of options, each starting with a |
|
|
hyphen charac-ffilename Read patterns from the |
|
|
file, one per line, and match all patterns against |
|
|
each line. There is a maximum of 100 patterns. |
|
51 |
Trailing white space is removed, and blank lines |
Trailing white space is removed, and blank lines |
52 |
are ignored. An empty file contains no patterns |
are ignored. An empty file contains no patterns |
53 |
and therefore matches nothing. |
and therefore matches nothing. |
73 |
error messages. The exit status indicates whether |
error messages. The exit status indicates whether |
74 |
any matches were found. |
any matches were found. |
75 |
|
|
76 |
|
-u Operate in UTF-8 mode. This option is available |
77 |
|
only if PCRE has been compiled with UTF-8 support. |
78 |
|
Both the pattern and each subject line are assumed |
79 |
|
to be valid strings of UTF-8 characters. |
80 |
|
|
81 |
-v Invert the sense of the match, so that lines which |
-v Invert the sense of the match, so that lines which |
82 |
do not match the pattern are now the ones that are |
do not match the pattern are now the ones that are |
83 |
found. |
found. |
90 |
the regular expression. |
the regular expression. |
91 |
|
|
92 |
|
|
93 |
|
LONG OPTIONS |
94 |
|
|
95 |
SEE ALSO |
Long forms of all the options are available, as in GNU grep. |
96 |
pcre(3), Perl 5 documentation |
They are shown in the following table: |
|
|
|
97 |
|
|
98 |
|
-c --count |
99 |
|
-h --no-filename |
100 |
|
-i --ignore-case |
101 |
|
-l --files-with-matches |
102 |
|
-n --line-number |
103 |
|
-r --recursive |
104 |
|
-s --no-messages |
105 |
|
-u --utf-8 |
106 |
|
-V --version |
107 |
|
-v --invert-match |
108 |
|
-x --line-regex |
109 |
|
-x --line-regexp |
110 |
|
|
111 |
|
In addition, --file=filename is equivalent to -ffilename, |
112 |
|
and --help shows the list of options and then exits. |
113 |
|
|
114 |
|
|
115 |
DIAGNOSTICS |
DIAGNOSTICS |
116 |
|
|
117 |
Exit status is 0 if any matches were found, 1 if no matches |
Exit status is 0 if any matches were found, 1 if no matches |
118 |
were found, and 2 for syntax errors or inacessible files |
were found, and 2 for syntax errors or inacessible files |
119 |
(even if matches were found). |
(even if matches were found). |
121 |
|
|
122 |
|
|
123 |
AUTHOR |
AUTHOR |
124 |
|
|
125 |
Philip Hazel <ph10@cam.ac.uk> |
Philip Hazel <ph10@cam.ac.uk> |
126 |
|
University Computing Service |
127 |
|
Cambridge CB2 3QG, England. |
128 |
|
|
129 |
Last updated: 15 August 2001 |
Last updated: 03 February 2003 |
130 |
Copyright (c) 1997-2001 University of Cambridge. |
Copyright (c) 1997-2003 University of Cambridge. |