| 1 |
NAME
|
| 2 |
pgrep - a grep with Perl-compatible regular expressions.
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
SYNOPSIS
|
| 7 |
pgrep [-Vchilnsvx] pattern [file] ...
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
DESCRIPTION
|
| 12 |
pgrep searches files for character patterns, in the same way
|
| 13 |
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, pgrep reads the standard input.
|
| 19 |
By default, each line that matches the pattern is copied to
|
| 20 |
the standard output, and if there is more than one file, the
|
| 21 |
file name is printed before each line of output. However,
|
| 22 |
there are options that can change how pgrep behaves.
|
| 23 |
|
| 24 |
Lines are limited to BUFSIZ characters. BUFSIZ is defined in
|
| 25 |
<stdio.h>. The newline character is removed from the end of
|
| 26 |
each line before it is matched against the pattern.
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
OPTIONS
|
| 31 |
-V Write the version number of the PCRE library being
|
| 32 |
used to the standard error stream.
|
| 33 |
|
| 34 |
-c Do not print individual lines; instead just print
|
| 35 |
a count of the number of lines that would other-
|
| 36 |
wise have been printed. If several files are
|
| 37 |
given, a count is printed for each of them.
|
| 38 |
|
| 39 |
-h Suppress printing of filenames when searching mul-
|
| 40 |
tiple files.
|
| 41 |
|
| 42 |
-i Ignore upper/lower case distinctions during com-
|
| 43 |
parisons.
|
| 44 |
|
| 45 |
-l Instead of printing lines from the files, just
|
| 46 |
print the names of the files containing lines that
|
| 47 |
would have been printed. Each file name is printed
|
| 48 |
once, on a separate line.
|
| 49 |
|
| 50 |
-n Precede each line by its line number in the file.
|
| 51 |
|
| 52 |
-s Work silently, that is, display nothing except
|
| 53 |
error messages. The exit status indicates whether
|
| 54 |
any matches were found.
|
| 55 |
|
| 56 |
-v Invert the sense of the match, so that lines which
|
| 57 |
do not match the pattern are now the ones that are
|
| 58 |
found.
|
| 59 |
|
| 60 |
-x Force the pattern to be anchored (it must start
|
| 61 |
matching at the beginning of the line) and in
|
| 62 |
addition, require it to match the entire line.
|
| 63 |
This is equivalent to having ^ and $ characters at
|
| 64 |
the start and end of each alternative branch in
|
| 65 |
the regular expression.
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
SEE ALSO
|
| 70 |
pcre(3), Perl 5 documentation
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
DIAGNOSTICS
|
| 77 |
Exit status is 0 if any matches were found, 1 if no matches
|
| 78 |
were found, and 2 for syntax errors or inacessible files
|
| 79 |
(even if matches were found).
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
AUTHOR
|
| 84 |
Philip Hazel <ph10@cam.ac.uk>
|
| 85 |
Copyright (c) 1997-1999 University of Cambridge.
|
| 86 |
|