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