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