summaryrefslogtreecommitdiff
path: root/doc/pcregrep.txt
blob: 477e80d879c3bfe7365a99cb30547fbb557c60d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
NAME
     pcregrep - a grep with Perl-compatible regular expressions.



SYNOPSIS
     pcregrep [-Vcfhilnrsvx] pattern [file] ...



DESCRIPTION
     pcregrep searches files for character patterns, in the  same
     way  as other grep commands do, but it uses the PCRE regular
     expression library to support patterns that  are  compatible
     with  the  regular  expressions of Perl 5. See pcre(3) for a
     full description of syntax and semantics.

     If no files  are  specified,  pcregrep  reads  the  standard
     input.  By  default,  each  line that matches the pattern is
     copied to the standard output, and if there is more than one
     file,  the  file name is printed before each line of output.
     However, there are options  that  can  change  how  pcregrep
     behaves.

     Lines are limited to BUFSIZ characters. BUFSIZ is defined in
     <stdio.h>.  The newline character is removed from the end of
     each line before it is matched against the pattern.



OPTIONS
     -V        Write the version number of the PCRE library being
               used to the standard error stream.

     -c        Do not print individual lines; instead just  print
               a  count  of the number of lines that would other-
               wise have  been  printed.  If  several  files  are
               given, a count is printed for each of them.

       versity of Cambridge for use on Unix systems connected  to
                      the  Internet.   It   is  freely  available
               under the terms of
                      the GNU General Public Licence. In style it
               is similar  to
                      Smail  3,  but  its   facilities  are  more
               extensive, and in
                      particular it has  some  defences   against
               mail  bombs  and
                      unsolicited  junk  mail,  in  the  form  of
               options for refusing
                      messages from particular  hosts,  networks,
               or senders.

                      Exim's command  line  takes  the   standard

               Unix  form  of  a
                      sequence  of  options, each starting with a
               hyphen  charac-ffilename  Read  patterns  from the
               file, one per line, and match all patterns against
               each  line.  There  is  a maximum of 100 patterns.
               Trailing white space is removed, and  blank  lines
               are  ignored.  An  empty file contains no patterns
               and therefore matches nothing.

     -h        Suppress printing of filenames when searching mul-
               tiple files.

     -i        Ignore upper/lower case distinctions  during  com-
               parisons.

     -l        Instead of printing lines  from  the  files,  just
               print the names of the files containing lines that
               would have been printed. Each file name is printed
               once, on a separate line.

     -n        Precede each line by its line number in the file.

     -r        If any file is a directory, recursively  scan  the
               files  it  contains.  Without  -r  a  directory is
               scanned as a normal file.

     -s        Work silently, that  is,  display  nothing  except
               error messages.  The exit status indicates whether
               any matches were found.

     -v        Invert the sense of the match, so that lines which
               do not match the pattern are now the ones that are
               found.

     -x        Force the pattern to be anchored  (it  must  start
               matching  at  the  beginning  of  the line) and in
               addition, require it to  match  the  entire  line.
               This is equivalent to having ^ and $ characters at
               the start and end of each  alternative  branch  in
               the regular expression.



SEE ALSO
     pcre(3), Perl 5 documentation





DIAGNOSTICS
     Exit status is 0 if any matches were found, 1 if no  matches
     were  found,  and  2  for syntax errors or inacessible files
     (even if matches were found).



AUTHOR
     Philip Hazel <ph10@cam.ac.uk>

     Last updated: 15 August 2001
     Copyright (c) 1997-2001 University of Cambridge.