2001-02-20 22:00:33 +00:00
|
|
|
.TH PCREGREP 1
|
2000-04-11 17:36:06 +00:00
|
|
|
.SH NAME
|
2001-02-20 22:00:33 +00:00
|
|
|
pcregrep - a grep with Perl-compatible regular expressions.
|
2000-04-11 17:36:06 +00:00
|
|
|
.SH SYNOPSIS
|
2002-09-14 14:45:35 +00:00
|
|
|
.B pcregrep [-Vcfhilnrsvx] pattern [file] ...
|
2000-04-11 17:36:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
.SH DESCRIPTION
|
2001-02-20 22:00:33 +00:00
|
|
|
\fBpcregrep\fR searches files for character patterns, in the same way as other
|
2000-04-11 17:36:06 +00:00
|
|
|
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
|
|
|
|
\fBpcre(3)\fR for a full description of syntax and semantics.
|
|
|
|
|
2001-02-20 22:00:33 +00:00
|
|
|
If no files are specified, \fBpcregrep\fR reads the standard input. By default,
|
2000-04-11 17:36:06 +00:00
|
|
|
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
|
2001-02-20 22:00:33 +00:00
|
|
|
output. However, there are options that can change how \fBpcregrep\fR behaves.
|
2000-04-11 17:36:06 +00:00
|
|
|
|
|
|
|
Lines are limited to BUFSIZ characters. BUFSIZ is defined in \fB<stdio.h>\fR.
|
|
|
|
The newline character is removed from the end of each line before it is matched
|
|
|
|
against the pattern.
|
|
|
|
|
|
|
|
|
|
|
|
.SH OPTIONS
|
|
|
|
.TP 10
|
|
|
|
\fB-V\fR
|
|
|
|
Write the version number of the PCRE library being used to the standard error
|
|
|
|
stream.
|
|
|
|
.TP
|
|
|
|
\fB-c\fR
|
|
|
|
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.
|
|
|
|
.TP
|
2002-09-14 14:45:35 +00:00
|
|
|
\fB-f\fIfilename\fR
|
|
|
|
Read patterns from the file, one per line, and match all patterns against each
|
|
|
|
line. 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.
|
|
|
|
.TP
|
2000-04-11 17:36:06 +00:00
|
|
|
\fB-h\fR
|
|
|
|
Suppress printing of filenames when searching multiple files.
|
|
|
|
.TP
|
|
|
|
\fB-i\fR
|
|
|
|
Ignore upper/lower case distinctions during comparisons.
|
|
|
|
.TP
|
|
|
|
\fB-l\fR
|
|
|
|
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.
|
|
|
|
.TP
|
|
|
|
\fB-n\fR
|
|
|
|
Precede each line by its line number in the file.
|
|
|
|
.TP
|
2002-09-14 14:45:35 +00:00
|
|
|
\fB-r\fR
|
|
|
|
If any file is a directory, recursively scan the files it contains. Without
|
|
|
|
\fB-r\fR a directory is scanned as a normal file.
|
|
|
|
.TP
|
2000-04-11 17:36:06 +00:00
|
|
|
\fB-s\fR
|
|
|
|
Work silently, that is, display nothing except error messages.
|
|
|
|
The exit status indicates whether any matches were found.
|
|
|
|
.TP
|
|
|
|
\fB-v\fR
|
|
|
|
Invert the sense of the match, so that lines which do \fInot\fR match the
|
|
|
|
pattern are now the ones that are found.
|
|
|
|
.TP
|
|
|
|
\fB-x\fR
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
.SH SEE ALSO
|
|
|
|
\fBpcre(3)\fR, Perl 5 documentation
|
|
|
|
|
|
|
|
|
|
|
|
.SH DIAGNOSTICS
|
|
|
|
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).
|
|
|
|
|
|
|
|
|
|
|
|
.SH AUTHOR
|
|
|
|
Philip Hazel <ph10@cam.ac.uk>
|
2002-09-14 14:45:35 +00:00
|
|
|
|
|
|
|
Last updated: 15 August 2001
|
2000-04-11 17:36:06 +00:00
|
|
|
.br
|
2002-09-14 14:45:35 +00:00
|
|
|
Copyright (c) 1997-2001 University of Cambridge.
|