| 1 |
nigel |
41 |
.TH PGREP 1 |
| 2 |
|
|
.SH NAME |
| 3 |
|
|
pgrep - a grep with Perl-compatible regular expressions. |
| 4 |
|
|
.SH SYNOPSIS |
| 5 |
|
|
.B pgrep [-Vchilnsvx] pattern [file] ... |
| 6 |
|
|
|
| 7 |
|
|
|
| 8 |
|
|
.SH DESCRIPTION |
| 9 |
|
|
\fBpgrep\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, \fBpgrep\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 \fBpgrep\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 |
|
|
\fB-h\fR |
| 36 |
|
|
Suppress printing of filenames when searching multiple files. |
| 37 |
|
|
.TP |
| 38 |
|
|
\fB-i\fR |
| 39 |
|
|
Ignore upper/lower case distinctions during comparisons. |
| 40 |
|
|
.TP |
| 41 |
|
|
\fB-l\fR |
| 42 |
|
|
Instead of printing lines from the files, just print the names of the files |
| 43 |
|
|
containing lines that would have been printed. Each file name is printed |
| 44 |
|
|
once, on a separate line. |
| 45 |
|
|
.TP |
| 46 |
|
|
\fB-n\fR |
| 47 |
|
|
Precede each line by its line number in the file. |
| 48 |
|
|
.TP |
| 49 |
|
|
\fB-s\fR |
| 50 |
|
|
Work silently, that is, display nothing except error messages. |
| 51 |
|
|
The exit status indicates whether any matches were found. |
| 52 |
|
|
.TP |
| 53 |
|
|
\fB-v\fR |
| 54 |
|
|
Invert the sense of the match, so that lines which do \fInot\fR match the |
| 55 |
|
|
pattern are now the ones that are found. |
| 56 |
|
|
.TP |
| 57 |
|
|
\fB-x\fR |
| 58 |
|
|
Force the pattern to be anchored (it must start matching at the beginning of |
| 59 |
|
|
the line) and in addition, require it to match the entire line. This is |
| 60 |
|
|
equivalent to having ^ and $ characters at the start and end of each |
| 61 |
|
|
alternative branch in the regular expression. |
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
.SH SEE ALSO |
| 65 |
|
|
\fBpcre(3)\fR, Perl 5 documentation |
| 66 |
|
|
|
| 67 |
|
|
|
| 68 |
|
|
.SH DIAGNOSTICS |
| 69 |
|
|
Exit status is 0 if any matches were found, 1 if no matches were found, and 2 |
| 70 |
|
|
for syntax errors or inacessible files (even if matches were found). |
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
.SH AUTHOR |
| 74 |
|
|
Philip Hazel <ph10@cam.ac.uk> |
| 75 |
|
|
.br |
| 76 |
|
|
Copyright (c) 1997-1999 University of Cambridge. |