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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 392 by ph10, Tue Mar 17 21:30:30 2009 UTC revision 429 by ph10, Tue Sep 1 16:10:16 2009 UTC
# Line 92  SUPPORT FOR COMPRESSED FILES Line 92  SUPPORT FOR COMPRESSED FILES
92    
93  OPTIONS  OPTIONS
94    
95         --        This terminate the list of options. It is useful if the  next         The order in which some of the options appear can  affect  the  output.
96                   item  on  the command line starts with a hyphen but is not an         For  example,  both  the  -h and -l options affect the printing of file
97                   option. This allows for the processing of patterns and  file-         names. Whichever comes later in the command line will be the  one  that
98           takes effect.
99    
100           --        This  terminate the list of options. It is useful if the next
101                     item on the command line starts with a hyphen but is  not  an
102                     option.  This allows for the processing of patterns and file-
103                   names that start with hyphens.                   names that start with hyphens.
104    
105         -A number, --after-context=number         -A number, --after-context=number
106                   Output  number  lines of context after each matching line. If                   Output number lines of context after each matching  line.  If
107                   filenames and/or line numbers are being output, a hyphen sep-                   filenames and/or line numbers are being output, a hyphen sep-
108                   arator  is  used  instead of a colon for the context lines. A                   arator is used instead of a colon for the  context  lines.  A
109                   line containing "--" is output between each group  of  lines,                   line  containing  "--" is output between each group of lines,
110                   unless  they  are  in  fact contiguous in the input file. The                   unless they are in fact contiguous in  the  input  file.  The
111                   value of number is expected to be relatively small.  However,                   value  of number is expected to be relatively small. However,
112                   pcregrep guarantees to have up to 8K of following text avail-                   pcregrep guarantees to have up to 8K of following text avail-
113                   able for context output.                   able for context output.
114    
115         -B number, --before-context=number         -B number, --before-context=number
116                   Output number lines of context before each matching line.  If                   Output  number lines of context before each matching line. If
117                   filenames and/or line numbers are being output, a hyphen sep-                   filenames and/or line numbers are being output, a hyphen sep-
118                   arator is used instead of a colon for the  context  lines.  A                   arator  is  used  instead of a colon for the context lines. A
119                   line  containing  "--" is output between each group of lines,                   line containing "--" is output between each group  of  lines,
120                   unless they are in fact contiguous in  the  input  file.  The                   unless  they  are  in  fact contiguous in the input file. The
121                   value  of number is expected to be relatively small. However,                   value of number is expected to be relatively small.  However,
122                   pcregrep guarantees to have up to 8K of preceding text avail-                   pcregrep guarantees to have up to 8K of preceding text avail-
123                   able for context output.                   able for context output.
124    
125         -C number, --context=number         -C number, --context=number
126                   Output  number  lines  of  context both before and after each                   Output number lines of context both  before  and  after  each
127                   matching line.  This is equivalent to setting both -A and  -B                   matching  line.  This is equivalent to setting both -A and -B
128                   to the same value.                   to the same value.
129    
130         -c, --count         -c, --count
131                   Do  not  output individual lines; instead just output a count                   Do not output individual lines from the files that are  being
132                   of the number of lines that would otherwise have been output.                   scanned; instead output the number of lines that would other-
133                   If  several  files  are  given, a count is output for each of                   wise have been shown. If no lines are  selected,  the  number
134                   them. In this mode, the -A, -B, and -C options are ignored.                   zero  is  output.  If  several files are are being scanned, a
135                     count is output for each of them. However,  if  the  --files-
136                     with-matches  option  is  also  used,  only those files whose
137                     counts are greater than zero are listed. When -c is used, the
138                     -A, -B, and -C options are ignored.
139    
140         --colour, --color         --colour, --color
141                   If this option is given without any data, it is equivalent to                   If this option is given without any data, it is equivalent to
142                   "--colour=auto".   If  data  is required, it must be given in                   "--colour=auto".  If data is required, it must  be  given  in
143                   the same shell item, separated by an equals sign.                   the same shell item, separated by an equals sign.
144    
145         --colour=value, --color=value         --colour=value, --color=value
146                   This option specifies under what circumstances the parts of a                   This option specifies under what circumstances the parts of a
147                   line that matched a pattern should be coloured in the output.                   line that matched a pattern should be coloured in the output.
148                   By default, the output is not coloured. The value  (which  is                   By  default,  the output is not coloured. The value (which is
149                   optional,  see above) may be "never", "always", or "auto". In                   optional, see above) may be "never", "always", or "auto".  In
150                   the latter case, colouring happens only if the standard  out-                   the  latter case, colouring happens only if the standard out-
151                   put  is connected to a terminal. More resources are used when                   put is connected to a terminal. More resources are used  when
152                   colouring is enabled, because pcregrep has to search for  all                   colouring  is enabled, because pcregrep has to search for all
153                   possible  matches in a line, not just one, in order to colour                   possible matches in a line, not just one, in order to  colour
154                   them all.                   them all.
155    
156                   The colour that is used can be specified by setting the envi-                   The colour that is used can be specified by setting the envi-
157                   ronment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value                   ronment variable PCREGREP_COLOUR or PCREGREP_COLOR. The value
158                   of this variable should be a string of two numbers, separated                   of this variable should be a string of two numbers, separated
159                   by  a  semicolon.  They  are copied directly into the control                   by a semicolon. They are copied  directly  into  the  control
160                   string for setting colour  on  a  terminal,  so  it  is  your                   string  for  setting  colour  on  a  terminal,  so it is your
161                   responsibility  to ensure that they make sense. If neither of                   responsibility to ensure that they make sense. If neither  of
162                   the environment variables is  set,  the  default  is  "1;31",                   the  environment  variables  is  set,  the default is "1;31",
163                   which gives red.                   which gives red.
164    
165         -D action, --devices=action         -D action, --devices=action
166                   If  an  input  path  is  not  a  regular file or a directory,                   If an input path is  not  a  regular  file  or  a  directory,
167                   "action" specifies how it is to be  processed.  Valid  values                   "action"  specifies  how  it is to be processed. Valid values
168                   are "read" (the default) or "skip" (silently skip the path).                   are "read" (the default) or "skip" (silently skip the path).
169    
170         -d action, --directories=action         -d action, --directories=action
171                   If an input path is a directory, "action" specifies how it is                   If an input path is a directory, "action" specifies how it is
172                   to be processed.  Valid  values  are  "read"  (the  default),                   to  be  processed.   Valid  values  are "read" (the default),
173                   "recurse"  (equivalent to the -r option), or "skip" (silently                   "recurse" (equivalent to the -r option), or "skip"  (silently
174                   skip the path). In the default case, directories are read  as                   skip  the path). In the default case, directories are read as
175                   if  they  were  ordinary files. In some operating systems the                   if they were ordinary files. In some  operating  systems  the
176                   effect of reading a directory like this is an immediate  end-                   effect  of reading a directory like this is an immediate end-
177                   of-file.                   of-file.
178    
179         -e pattern, --regex=pattern, --regexp=pattern         -e pattern, --regex=pattern, --regexp=pattern
180                   Specify a pattern to be matched. This option can be used mul-                   Specify a pattern to be matched. This option can be used mul-
181                   tiple times in order to specify several patterns. It can also                   tiple times in order to specify several patterns. It can also
182                   be  used  as a way of specifying a single pattern that starts                   be used as a way of specifying a single pattern  that  starts
183                   with a hyphen. When -e is used, no argument pattern is  taken                   with  a hyphen. When -e is used, no argument pattern is taken
184                   from  the  command  line;  all  arguments are treated as file                   from the command line; all  arguments  are  treated  as  file
185                   names. There is an overall maximum of 100 patterns. They  are                   names.  There is an overall maximum of 100 patterns. They are
186                   applied  to  each line in the order in which they are defined                   applied to each line in the order in which they  are  defined
187                   until one matches (or fails to match if -v is used). If -f is                   until one matches (or fails to match if -v is used). If -f is
188                   used  with  -e,  the command line patterns are matched first,                   used with -e, the command line patterns  are  matched  first,
189                   followed by the patterns from the file,  independent  of  the                   followed  by  the  patterns from the file, independent of the
190                   order  in which these options are specified. Note that multi-                   order in which these options are specified. Note that  multi-
191                   ple use of -e is not the same as a single pattern with alter-                   ple use of -e is not the same as a single pattern with alter-
192                   natives. For example, X|Y finds the first character in a line                   natives. For example, X|Y finds the first character in a line
193                   that is X or Y, whereas if the two patterns are  given  sepa-                   that  is  X or Y, whereas if the two patterns are given sepa-
194                   rately, pcregrep finds X if it is present, even if it follows                   rately, pcregrep finds X if it is present, even if it follows
195                   Y in the line. It finds Y only if there is no X in the  line.                   Y  in the line. It finds Y only if there is no X in the line.
196                   This  really  matters  only  if  you are using -o to show the                   This really matters only if you are  using  -o  to  show  the
197                   part(s) of the line that matched.                   part(s) of the line that matched.
198    
199         --exclude=pattern         --exclude=pattern
200                   When pcregrep is searching the files in a directory as a con-                   When pcregrep is searching the files in a directory as a con-
201                   sequence  of  the  -r  (recursive search) option, any regular                   sequence of the -r (recursive  search)  option,  any  regular
202                   files whose names match the pattern are excluded. Subdirecto-                   files whose names match the pattern are excluded. Subdirecto-
203                   ries  are  not  excluded  by  this  option; they are searched                   ries are not excluded  by  this  option;  they  are  searched
204                   recursively, subject to the --exclude_dir  and  --include_dir                   recursively,  subject  to the --exclude_dir and --include_dir
205                   options.  The  pattern  is  a PCRE regular expression, and is                   options. The pattern is a PCRE  regular  expression,  and  is
206                   matched against the final component of the file name (not the                   matched against the final component of the file name (not the
207                   entire  path).  If  a  file  name  matches both --include and                   entire path). If a  file  name  matches  both  --include  and
208                   --exclude, it is excluded.  There is no short form  for  this                   --exclude,  it  is excluded.  There is no short form for this
209                   option.                   option.
210    
211         --exclude_dir=pattern         --exclude_dir=pattern
212                   When  pcregrep  is searching the contents of a directory as a                   When pcregrep is searching the contents of a directory  as  a
213                   consequence of the -r (recursive search) option,  any  subdi-                   consequence  of  the -r (recursive search) option, any subdi-
214                   rectories  whose  names match the pattern are excluded. (Note                   rectories whose names match the pattern are  excluded.  (Note
215                   that the --exclude option does  not  affect  subdirectories.)                   that  the  --exclude  option does not affect subdirectories.)
216                   The  pattern  is  a  PCRE  regular expression, and is matched                   The pattern is a PCRE  regular  expression,  and  is  matched
217                   against the final component  of  the  name  (not  the  entire                   against  the  final  component  of  the  name (not the entire
218                   path).  If a subdirectory name matches both --include_dir and                   path). If a subdirectory name matches both --include_dir  and
219                   --exclude_dir, it is excluded. There is  no  short  form  for                   --exclude_dir,  it  is  excluded.  There is no short form for
220                   this option.                   this option.
221    
222         -F, --fixed-strings         -F, --fixed-strings
223                   Interpret  each pattern as a list of fixed strings, separated                   Interpret each pattern as a list of fixed strings,  separated
224                   by newlines, instead of  as  a  regular  expression.  The  -w                   by  newlines,  instead  of  as  a  regular expression. The -w
225                   (match  as  a  word) and -x (match whole line) options can be                   (match as a word) and -x (match whole line)  options  can  be
226                   used with -F. They apply to each of the fixed strings. A line                   used with -F. They apply to each of the fixed strings. A line
227                   is selected if any of the fixed strings are found in it (sub-                   is selected if any of the fixed strings are found in it (sub-
228                   ject to -w or -x, if present).                   ject to -w or -x, if present).
229    
230         -f filename, --file=filename         -f filename, --file=filename
231                   Read a number of patterns from the file, one  per  line,  and                   Read  a  number  of patterns from the file, one per line, and
232                   match  them against each line of input. A data line is output                   match them against each line of input. A data line is  output
233                   if any of the patterns match it. The filename can be given as                   if any of the patterns match it. The filename can be given as
234                   "-" to refer to the standard input. When -f is used, patterns                   "-" to refer to the standard input. When -f is used, patterns
235                   specified on the command line using -e may also  be  present;                   specified  on  the command line using -e may also be present;
236                   they are tested before the file's patterns. However, no other                   they are tested before the file's patterns. However, no other
237                   pattern is taken from the command  line;  all  arguments  are                   pattern  is  taken  from  the command line; all arguments are
238                   treated  as  file  names.  There is an overall maximum of 100                   treated as file names. There is an  overall  maximum  of  100
239                   patterns. Trailing white space is removed from each line, and                   patterns. Trailing white space is removed from each line, and
240                   blank  lines  are ignored. An empty file contains no patterns                   blank lines are ignored. An empty file contains  no  patterns
241                   and therefore matches nothing. See also  the  comments  about                   and  therefore  matches  nothing. See also the comments about
242                   multiple  patterns  versus a single pattern with alternatives                   multiple patterns versus a single pattern  with  alternatives
243                   in the description of -e above.                   in the description of -e above.
244    
245         --file-offsets         --file-offsets
246                   Instead of showing lines or parts of lines that  match,  show                   Instead  of  showing lines or parts of lines that match, show
247                   each  match  as  an  offset  from the start of the file and a                   each match as an offset from the start  of  the  file  and  a
248                   length, separated by a comma. In this  mode,  no  context  is                   length,  separated  by  a  comma. In this mode, no context is
249                   shown.  That  is,  the -A, -B, and -C options are ignored. If                   shown. That is, the -A, -B, and -C options  are  ignored.  If
250                   there is more than one match in a line, each of them is shown                   there is more than one match in a line, each of them is shown
251                   separately.  This  option  is mutually exclusive with --line-                   separately. This option is mutually  exclusive  with  --line-
252                   offsets and --only-matching.                   offsets and --only-matching.
253    
254         -H, --with-filename         -H, --with-filename
255                   Force the inclusion of the filename at the  start  of  output                   Force  the  inclusion  of the filename at the start of output
256                   lines  when searching a single file. By default, the filename                   lines when searching a single file. By default, the  filename
257                   is not shown in this case. For matching lines,  the  filename                   is  not  shown in this case. For matching lines, the filename
258                   is followed by a colon; for context lines, a hyphen separator                   is followed by a colon; for context lines, a hyphen separator
259                   is used. If a line number is also being  output,  it  follows                   is  used.  If  a line number is also being output, it follows
260                   the file name.                   the file name.
261    
262         -h, --no-filename         -h, --no-filename
263                   Suppress  the output filenames when searching multiple files.                   Suppress the output filenames when searching multiple  files.
264                   By default, filenames  are  shown  when  multiple  files  are                   By  default,  filenames  are  shown  when  multiple files are
265                   searched.  For  matching lines, the filename is followed by a                   searched. For matching lines, the filename is followed  by  a
266                   colon; for context lines, a hyphen separator is used.   If  a                   colon;  for  context lines, a hyphen separator is used.  If a
267                   line number is also being output, it follows the file name.                   line number is also being output, it follows the file name.
268    
269         --help    Output  a  help  message, giving brief details of the command         --help    Output a help message, giving brief details  of  the  command
270                   options and file type support, and then exit.                   options and file type support, and then exit.
271    
272         -i, --ignore-case         -i, --ignore-case
# Line 267  OPTIONS Line 276  OPTIONS
276                   When pcregrep is searching the files in a directory as a con-                   When pcregrep is searching the files in a directory as a con-
277                   sequence of the -r (recursive search) option, only those reg-                   sequence of the -r (recursive search) option, only those reg-
278                   ular files whose names match the pattern are included. Subdi-                   ular files whose names match the pattern are included. Subdi-
279                   rectories  are always included and searched recursively, sub-                   rectories are always included and searched recursively,  sub-
280                   ject to the --include_dir and --exclude_dir options. The pat-                   ject to the --include_dir and --exclude_dir options. The pat-
281                   tern is a PCRE regular expression, and is matched against the                   tern is a PCRE regular expression, and is matched against the
282                   final component of the file name (not the entire path). If  a                   final  component of the file name (not the entire path). If a
283                   file  name  matches  both  --include  and  --exclude,  it  is                   file  name  matches  both  --include  and  --exclude,  it  is
284                   excluded. There is no short form for this option.                   excluded. There is no short form for this option.
285    
286         --include_dir=pattern         --include_dir=pattern
287                   When pcregrep is searching the contents of a directory  as  a                   When  pcregrep  is searching the contents of a directory as a
288                   consequence  of  the -r (recursive search) option, only those                   consequence of the -r (recursive search) option,  only  those
289                   subdirectories whose names match the  pattern  are  included.                   subdirectories  whose  names  match the pattern are included.
290                   (Note  that  the --include option does not affect subdirecto-                   (Note that the --include option does not  affect  subdirecto-
291                   ries.) The pattern is  a  PCRE  regular  expression,  and  is                   ries.)  The  pattern  is  a  PCRE  regular expression, and is
292                   matched  against  the  final  component  of the name (not the                   matched against the final component  of  the  name  (not  the
293                   entire  path).  If   a   subdirectory   name   matches   both                   entire   path).   If   a   subdirectory   name  matches  both
294                   --include_dir  and --exclude_dir, it is excluded. There is no                   --include_dir and --exclude_dir, it is excluded. There is  no
295                   short form for this option.                   short form for this option.
296    
297         -L, --files-without-match         -L, --files-without-match
298                   Instead of outputting lines from the files, just  output  the                   Instead  of  outputting lines from the files, just output the
299                   names  of  the files that do not contain any lines that would                   names of the files that do not contain any lines  that  would
300                   have been output. Each file name is output once, on  a  sepa-                   have  been  output. Each file name is output once, on a sepa-
301                   rate line.                   rate line.
302    
303         -l, --files-with-matches         -l, --files-with-matches
304                   Instead  of  outputting lines from the files, just output the                   Instead of outputting lines from the files, just  output  the
305                   names of the files containing lines that would have been out-                   names of the files containing lines that would have been out-
306                   put.  Each  file  name  is  output  once, on a separate line.                   put. Each file name is  output  once,  on  a  separate  line.
307                   Searching stops as soon as a matching  line  is  found  in  a                   Searching  normally stops as soon as a matching line is found
308                   file.                   in a file. However, if the -c (count) option  is  also  used,
309                     matching  continues in order to obtain the correct count, and
310                     those files that have at least one  match  are  listed  along
311                     with their counts. Using this option with -c is a way of sup-
312                     pressing the listing of files with no matches.
313    
314         --label=name         --label=name
315                   This option supplies a name to be used for the standard input                   This option supplies a name to be used for the standard input
# Line 304  OPTIONS Line 317  OPTIONS
317                   input)" is used. There is no short form for this option.                   input)" is used. There is no short form for this option.
318    
319         --line-offsets         --line-offsets
320                   Instead  of  showing lines or parts of lines that match, show                   Instead of showing lines or parts of lines that  match,  show
321                   each match as a line number, the offset from the start of the                   each match as a line number, the offset from the start of the
322                   line,  and a length. The line number is terminated by a colon                   line, and a length. The line number is terminated by a  colon
323                   (as usual; see the -n option), and the offset and length  are                   (as  usual; see the -n option), and the offset and length are
324                   separated  by  a  comma.  In  this mode, no context is shown.                   separated by a comma. In this  mode,  no  context  is  shown.
325                   That is, the -A, -B, and -C options are ignored. If there  is                   That  is, the -A, -B, and -C options are ignored. If there is
326                   more  than  one  match in a line, each of them is shown sepa-                   more than one match in a line, each of them  is  shown  sepa-
327                   rately. This option is mutually exclusive with --file-offsets                   rately. This option is mutually exclusive with --file-offsets
328                   and --only-matching.                   and --only-matching.
329    
330         --locale=locale-name         --locale=locale-name
331                   This  option specifies a locale to be used for pattern match-                   This option specifies a locale to be used for pattern  match-
332                   ing. It overrides the value in the LC_ALL or  LC_CTYPE  envi-                   ing.  It  overrides the value in the LC_ALL or LC_CTYPE envi-
333                   ronment  variables.  If  no  locale  is  specified,  the PCRE                   ronment variables.  If  no  locale  is  specified,  the  PCRE
334                   library's default (usually the "C" locale) is used. There  is                   library's  default (usually the "C" locale) is used. There is
335                   no short form for this option.                   no short form for this option.
336    
337         -M, --multiline         -M, --multiline
338                   Allow  patterns to match more than one line. When this option                   Allow patterns to match more than one line. When this  option
339                   is given, patterns may usefully contain literal newline char-                   is given, patterns may usefully contain literal newline char-
340                   acters  and  internal  occurrences of ^ and $ characters. The                   acters and internal occurrences of ^ and  $  characters.  The
341                   output for any one match may consist of more than  one  line.                   output  for  any one match may consist of more than one line.
342                   When  this option is set, the PCRE library is called in "mul-                   When this option is set, the PCRE library is called in  "mul-
343                   tiline" mode.  There is a limit to the number of  lines  that                   tiline"  mode.   There is a limit to the number of lines that
344                   can  be matched, imposed by the way that pcregrep buffers the                   can be matched, imposed by the way that pcregrep buffers  the
345                   input file as it scans it. However, pcregrep ensures that  at                   input  file as it scans it. However, pcregrep ensures that at
346                   least 8K characters or the rest of the document (whichever is                   least 8K characters or the rest of the document (whichever is
347                   the shorter) are available for forward  matching,  and  simi-                   the  shorter)  are  available for forward matching, and simi-
348                   larly the previous 8K characters (or all the previous charac-                   larly the previous 8K characters (or all the previous charac-
349                   ters, if fewer than 8K) are guaranteed to  be  available  for                   ters,  if  fewer  than 8K) are guaranteed to be available for
350                   lookbehind assertions.                   lookbehind assertions.
351    
352         -N newline-type, --newline=newline-type         -N newline-type, --newline=newline-type
353                   The  PCRE  library  supports  five  different conventions for                   The PCRE library  supports  five  different  conventions  for
354                   indicating the ends of lines. They are  the  single-character                   indicating  the  ends of lines. They are the single-character
355                   sequences  CR  (carriage  return) and LF (linefeed), the two-                   sequences CR (carriage return) and LF  (linefeed),  the  two-
356                   character sequence CRLF, an "anycrlf" convention, which  rec-                   character  sequence CRLF, an "anycrlf" convention, which rec-
357                   ognizes  any  of the preceding three types, and an "any" con-                   ognizes any of the preceding three types, and an  "any"  con-
358                   vention, in which any Unicode line ending sequence is assumed                   vention, in which any Unicode line ending sequence is assumed
359                   to  end a line. The Unicode sequences are the three just men-                   to end a line. The Unicode sequences are the three just  men-
360                   tioned,  plus  VT  (vertical  tab,  U+000B),  FF   (formfeed,                   tioned,   plus  VT  (vertical  tab,  U+000B),  FF  (formfeed,
361                   U+000C),   NEL  (next  line,  U+0085),  LS  (line  separator,                   U+000C),  NEL  (next  line,  U+0085),  LS  (line   separator,
362                   U+2028), and PS (paragraph separator, U+2029).                   U+2028), and PS (paragraph separator, U+2029).
363    
364                   When  the  PCRE  library  is  built,  a  default  line-ending                   When  the  PCRE  library  is  built,  a  default  line-ending
365                   sequence   is  specified.   This  is  normally  the  standard                   sequence  is  specified.   This  is  normally  the   standard
366                   sequence for the operating system. Unless otherwise specified                   sequence for the operating system. Unless otherwise specified
367                   by  this  option,  pcregrep  uses the library's default.  The                   by this option, pcregrep uses  the  library's  default.   The
368                   possible values for this option are CR, LF, CRLF, ANYCRLF, or                   possible values for this option are CR, LF, CRLF, ANYCRLF, or
369                   ANY.  This  makes  it  possible to use pcregrep on files that                   ANY. This makes it possible to use  pcregrep  on  files  that
370                   have come from other environments without  having  to  modify                   have  come  from  other environments without having to modify
371                   their  line  endings.  If the data that is being scanned does                   their line endings. If the data that is  being  scanned  does
372                   not agree with the convention set by  this  option,  pcregrep                   not  agree  with  the convention set by this option, pcregrep
373                   may behave in strange ways.                   may behave in strange ways.
374    
375         -n, --line-number         -n, --line-number
376                   Precede each output line by its line number in the file, fol-                   Precede each output line by its line number in the file, fol-
377                   lowed by a colon for matching lines or a hyphen  for  context                   lowed  by  a colon for matching lines or a hyphen for context
378                   lines.  If the filename is also being output, it precedes the                   lines. If the filename is also being output, it precedes  the
379                   line number. This option is forced if --line-offsets is used.                   line number. This option is forced if --line-offsets is used.
380    
381         -o, --only-matching         -o, --only-matching
382                   Show only the part of the line that  matched  a  pattern.  In                   Show  only  the  part  of the line that matched a pattern. In
383                   this  mode,  no context is shown. That is, the -A, -B, and -C                   this mode, no context is shown. That is, the -A, -B,  and  -C
384                   options are ignored. If there is more than  one  match  in  a                   options  are  ignored.  If  there is more than one match in a
385                   line,  each  of  them  is shown separately. If -o is combined                   line, each of them is shown separately.  If  -o  is  combined
386                   with -v (invert the sense of the match to  find  non-matching                   with  -v  (invert the sense of the match to find non-matching
387                   lines),  no  output  is generated, but the return code is set                   lines), no output is generated, but the return  code  is  set
388                   appropriately. This option is mutually exclusive with --file-                   appropriately. This option is mutually exclusive with --file-
389                   offsets and --line-offsets.                   offsets and --line-offsets.
390    
391         -q, --quiet         -q, --quiet
392                   Work quietly, that is, display nothing except error messages.                   Work quietly, that is, display nothing except error messages.
393                   The exit status indicates whether or  not  any  matches  were                   The  exit  status  indicates  whether or not any matches were
394                   found.                   found.
395    
396         -r, --recursive         -r, --recursive
397                   If  any given path is a directory, recursively scan the files                   If any given path is a directory, recursively scan the  files
398                   it contains, taking note of any --include and --exclude  set-                   it  contains, taking note of any --include and --exclude set-
399                   tings.  By  default, a directory is read as a normal file; in                   tings. By default, a directory is read as a normal  file;  in
400                   some operating systems this gives an  immediate  end-of-file.                   some  operating  systems this gives an immediate end-of-file.
401                   This  option  is  a  shorthand  for  setting the -d option to                   This option is a shorthand  for  setting  the  -d  option  to
402                   "recurse".                   "recurse".
403    
404         -s, --no-messages         -s, --no-messages
405                   Suppress error  messages  about  non-existent  or  unreadable                   Suppress  error  messages  about  non-existent  or unreadable
406                   files.  Such  files  are quietly skipped. However, the return                   files. Such files are quietly skipped.  However,  the  return
407                   code is still 2, even if matches were found in other files.                   code is still 2, even if matches were found in other files.
408    
409         -u, --utf-8         -u, --utf-8
410                   Operate in UTF-8 mode. This option is available only if  PCRE                   Operate  in UTF-8 mode. This option is available only if PCRE
411                   has  been compiled with UTF-8 support. Both patterns and sub-                   has been compiled with UTF-8 support. Both patterns and  sub-
412                   ject lines must be valid strings of UTF-8 characters.                   ject lines must be valid strings of UTF-8 characters.
413    
414         -V, --version         -V, --version
415                   Write the version numbers of pcregrep and  the  PCRE  library                   Write  the  version  numbers of pcregrep and the PCRE library
416                   that is being used to the standard error stream.                   that is being used to the standard error stream.
417    
418         -v, --invert-match         -v, --invert-match
419                   Invert  the  sense  of  the match, so that lines which do not                   Invert the sense of the match, so that  lines  which  do  not
420                   match any of the patterns are the ones that are found.                   match any of the patterns are the ones that are found.
421    
422         -w, --word-regex, --word-regexp         -w, --word-regex, --word-regexp
# Line 411  OPTIONS Line 424  OPTIONS
424                   lent to having \b at the start and end of the pattern.                   lent to having \b at the start and end of the pattern.
425    
426         -x, --line-regex, --line-regexp         -x, --line-regex, --line-regexp
427                   Force  the  patterns to be anchored (each must start matching                   Force the patterns to be anchored (each must  start  matching
428                   at the beginning of a line) and in addition, require them  to                   at  the beginning of a line) and in addition, require them to
429                   match  entire  lines.  This  is  equivalent to having ^ and $                   match entire lines. This is equivalent  to  having  ^  and  $
430                   characters at the start and end of each alternative branch in                   characters at the start and end of each alternative branch in
431                   every pattern.                   every pattern.
432    
433    
434  ENVIRONMENT VARIABLES  ENVIRONMENT VARIABLES
435    
436         The  environment  variables  LC_ALL  and LC_CTYPE are examined, in that         The environment variables LC_ALL and LC_CTYPE  are  examined,  in  that
437         order, for a locale. The first one that is set is  used.  This  can  be         order,  for  a  locale.  The first one that is set is used. This can be
438         overridden  by  the  --locale  option.  If  no  locale is set, the PCRE         overridden by the --locale option.  If  no  locale  is  set,  the  PCRE
439         library's default (usually the "C" locale) is used.         library's default (usually the "C" locale) is used.
440    
441    
442  NEWLINES  NEWLINES
443    
444         The -N (--newline) option allows pcregrep to scan files with  different         The  -N (--newline) option allows pcregrep to scan files with different
445         newline  conventions  from  the  default.  However, the setting of this         newline conventions from the default.  However,  the  setting  of  this
446         option does not affect the way in which pcregrep writes information  to         option  does not affect the way in which pcregrep writes information to
447         the  standard  error  and  output streams. It uses the string "\n" in C         the standard error and output streams. It uses the  string  "\n"  in  C
448         printf() calls to indicate newlines, relying on the C  I/O  library  to         printf()  calls  to  indicate newlines, relying on the C I/O library to
449         convert  this  to  an  appropriate  sequence if the output is sent to a         convert this to an appropriate sequence if the  output  is  sent  to  a
450         file.         file.
451    
452    
453  OPTIONS COMPATIBILITY  OPTIONS COMPATIBILITY
454    
455         The majority of short and long forms of pcregrep's options are the same         The majority of short and long forms of pcregrep's options are the same
456         as  in  the  GNU grep program. Any long option of the form --xxx-regexp         as in the GNU grep program. Any long option of  the  form  --xxx-regexp
457         (GNU terminology) is also available as --xxx-regex (PCRE  terminology).         (GNU  terminology) is also available as --xxx-regex (PCRE terminology).
458         However,  the  --locale,  -M,  --multiline, -u, and --utf-8 options are         However, the --locale, -M, --multiline, -u,  and  --utf-8  options  are
459         specific to pcregrep.         specific to pcregrep. If both the -c and -l options are given, GNU grep
460           lists only file names, without counts, but pcregrep gives the counts.
461    
462    
463  OPTIONS WITH DATA  OPTIONS WITH DATA
# Line 508  AUTHOR Line 522  AUTHOR
522    
523  REVISION  REVISION
524    
525         Last updated: 01 March 2009         Last updated: 12 August 2009
526         Copyright (c) 1997-2009 University of Cambridge.         Copyright (c) 1997-2009 University of Cambridge.

Legend:
Removed from v.392  
changed lines
  Added in v.429

  ViewVC Help
Powered by ViewVC 1.1.5