2 pcregrep - a grep with Perl-compatible regular expressions.
7 pcregrep [-Vcfhilnrsvx] pattern [file] ...
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.
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
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.
32 -V Write the version number of the PCRE library being
33 used to the standard error stream.
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.
41 Read patterns from the file, one per line, and
42 match all patterns against each line. There is a
43 maximum of 100 patterns. Trailing white space is
44 removed, and blank lines are ignored. An empty
45 file contains no patterns and therefore matches
48 -h Suppress printing of filenames when searching mul-
51 -i Ignore upper/lower case distinctions during com-
54 -l Instead of printing lines from the files, just
56 print the names of the files containing lines that
57 would have been printed. Each file name is printed
58 once, on a separate line.
60 -n Precede each line by its line number in the file.
62 -r If any file is a directory, recursively scan the
63 files it contains. Without -r a directory is
64 scanned as a normal file.
66 -s Work silently, that is, display nothing except
67 error messages. The exit status indicates whether
68 any matches were found.
70 -v Invert the sense of the match, so that lines which
71 do not match the pattern are now the ones that are
74 -x Force the pattern to be anchored (it must start
75 matching at the beginning of the line) and in
76 addition, require it to match the entire line.
77 This is equivalent to having ^ and $ characters at
78 the start and end of each alternative branch in
79 the regular expression.
84 pcre(3), Perl 5 documentation
91 Exit status is 0 if any matches were found, 1 if no matches
92 were found, and 2 for syntax errors or inacessible files
93 (even if matches were found).
98 Philip Hazel <ph10@cam.ac.uk>
100 Last updated: 15 August 2001
101 Copyright (c) 1997-2001 University of Cambridge.