/[pcre]/code/trunk/doc/pcregrep.txt
ViewVC logotype

Contents of /code/trunk/doc/pcregrep.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 53 - (hide annotations) (download)
Sat Feb 24 21:39:42 2007 UTC (7 years, 9 months ago) by nigel
File MIME type: text/plain
File size: 3477 byte(s)
Load pcre-3.5 into code/trunk.

1 nigel 49 NAME
2     pcregrep - a grep with Perl-compatible regular expressions.
3    
4    
5    
6     SYNOPSIS
7 nigel 53 pcregrep [-Vcfhilnrsvx] pattern [file] ...
8 nigel 49
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 nigel 53 -ffilename
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
46     nothing.
47    
48 nigel 49 -h Suppress printing of filenames when searching mul-
49     tiple files.
50    
51     -i Ignore upper/lower case distinctions during com-
52     parisons.
53    
54     -l Instead of printing lines from the files, just
55 nigel 53
56 nigel 49 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.
59    
60     -n Precede each line by its line number in the file.
61    
62 nigel 53 -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.
65    
66 nigel 49 -s Work silently, that is, display nothing except
67     error messages. The exit status indicates whether
68     any matches were found.
69    
70     -v Invert the sense of the match, so that lines which
71     do not match the pattern are now the ones that are
72     found.
73    
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.
80    
81    
82    
83     SEE ALSO
84     pcre(3), Perl 5 documentation
85    
86    
87    
88    
89    
90     DIAGNOSTICS
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).
94    
95    
96    
97     AUTHOR
98     Philip Hazel <ph10@cam.ac.uk>
99    
100 nigel 53 Last updated: 15 August 2001
101     Copyright (c) 1997-2001 University of Cambridge.

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12