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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 55 - (show annotations)
Sat Feb 24 21:39:46 2007 UTC (8 years, 2 months ago) by nigel
File MIME type: text/plain
File size: 4303 byte(s)
Error occurred while calculating annotation data.
Load pcre-3.6 into code/trunk.
1 NAME
2 pcregrep - a grep with Perl-compatible regular expressions.
3
4
5
6 SYNOPSIS
7 pcregrep [-Vcfhilnrsvx] pattern [file] ...
8
9
10
11 DESCRIPTION
12 pcregrep searches files for character patterns, in the same
13 way as other grep commands do, but it uses the PCRE regular
14 expression library to support patterns that are compatible
15 with the regular expressions of Perl 5. See pcre(3) for a
16 full description of syntax and semantics.
17
18 If no files are specified, pcregrep reads the standard
19 input. By default, each line that matches the pattern is
20 copied to the standard output, and if there is more than one
21 file, the file name is printed before each line of output.
22 However, there are options that can change how pcregrep
23 behaves.
24
25 Lines are limited to BUFSIZ characters. BUFSIZ is defined in
26 <stdio.h>. The newline character is removed from the end of
27 each line before it is matched against the pattern.
28
29
30
31 OPTIONS
32 -V Write the version number of the PCRE library being
33 used to the standard error stream.
34
35 -c Do not print individual lines; instead just print
36 a count of the number of lines that would other-
37 wise have been printed. If several files are
38 given, a count is printed for each of them.
39
40 versity of Cambridge for use on Unix systems connected to
41 the Internet. It is freely available
42 under the terms of
43 the GNU General Public Licence. In style it
44 is similar to
45 Smail 3, but its facilities are more
46 extensive, and in
47 particular it has some defences against
48 mail bombs and
49 unsolicited junk mail, in the form of
50 options for refusing
51 messages from particular hosts, networks,
52 or senders.
53
54 Exim's command line takes the standard
55
56 Unix form of a
57 sequence of options, each starting with a
58 hyphen charac-ffilename Read patterns from the
59 file, one per line, and match all patterns against
60 each line. There is a maximum of 100 patterns.
61 Trailing white space is removed, and blank lines
62 are ignored. An empty file contains no patterns
63 and therefore matches nothing.
64
65 -h Suppress printing of filenames when searching mul-
66 tiple files.
67
68 -i Ignore upper/lower case distinctions during com-
69 parisons.
70
71 -l Instead of printing lines from the files, just
72 print the names of the files containing lines that
73 would have been printed. Each file name is printed
74 once, on a separate line.
75
76 -n Precede each line by its line number in the file.
77
78 -r If any file is a directory, recursively scan the
79 files it contains. Without -r a directory is
80 scanned as a normal file.
81
82 -s Work silently, that is, display nothing except
83 error messages. The exit status indicates whether
84 any matches were found.
85
86 -v Invert the sense of the match, so that lines which
87 do not match the pattern are now the ones that are
88 found.
89
90 -x Force the pattern to be anchored (it must start
91 matching at the beginning of the line) and in
92 addition, require it to match the entire line.
93 This is equivalent to having ^ and $ characters at
94 the start and end of each alternative branch in
95 the regular expression.
96
97
98
99 SEE ALSO
100 pcre(3), Perl 5 documentation
101
102
103
104
105
106 DIAGNOSTICS
107 Exit status is 0 if any matches were found, 1 if no matches
108 were found, and 2 for syntax errors or inacessible files
109 (even if matches were found).
110
111
112
113 AUTHOR
114 Philip Hazel <ph10@cam.ac.uk>
115
116 Last updated: 15 August 2001
117 Copyright (c) 1997-2001 University of Cambridge.

  ViewVC Help
Powered by ViewVC 1.1.5