/[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 571 by ph10, Sat Nov 6 17:10:00 2010 UTC revision 572 by ph10, Wed Nov 17 17:55:57 2010 UTC
# Line 202  OPTIONS Line 202  OPTIONS
202                   sequence  of  the  -r  (recursive search) option, any regular                   sequence  of  the  -r  (recursive search) option, any regular
203                   files whose names match the pattern are excluded. Subdirecto-                   files whose names match the pattern are excluded. Subdirecto-
204                   ries  are  not  excluded  by  this  option; they are searched                   ries  are  not  excluded  by  this  option; they are searched
205                   recursively, subject to the --exclude_dir  and  --include_dir                   recursively, subject to the --exclude-dir  and  --include_dir
206                   options.  The  pattern  is  a PCRE regular expression, and is                   options.  The  pattern  is  a PCRE regular expression, and is
207                   matched against the final component of the file name (not the                   matched against the final component of the file name (not the
208                   entire  path).  If  a  file  name  matches both --include and                   entire  path).  If  a  file  name  matches both --include and
209                   --exclude, it is excluded.  There is no short form  for  this                   --exclude, it is excluded.  There is no short form  for  this
210                   option.                   option.
211    
212         --exclude_dir=pattern         --exclude-dir=pattern
213                   When  pcregrep  is searching the contents of a directory as a                   When  pcregrep  is searching the contents of a directory as a
214                   consequence of the -r (recursive search) option,  any  subdi-                   consequence of the -r (recursive search) option,  any  subdi-
215                   rectories  whose  names match the pattern are excluded. (Note                   rectories  whose  names match the pattern are excluded. (Note
216                   that the --exclude option does  not  affect  subdirectories.)                   that the --exclude option does  not  affect  subdirectories.)
217                   The  pattern  is  a  PCRE  regular expression, and is matched                   The  pattern  is  a  PCRE  regular expression, and is matched
218                   against the final component  of  the  name  (not  the  entire                   against the final component  of  the  name  (not  the  entire
219                   path).  If a subdirectory name matches both --include_dir and                   path).  If a subdirectory name matches both --include-dir and
220                   --exclude_dir, it is excluded. There is  no  short  form  for                   --exclude-dir, it is excluded. There is  no  short  form  for
221                   this option.                   this option.
222    
223         -F, --fixed-strings         -F, --fixed-strings
# Line 278  OPTIONS Line 278  OPTIONS
278                   sequence of the -r (recursive search) option, only those reg-                   sequence of the -r (recursive search) option, only those reg-
279                   ular files whose names match the pattern are included. Subdi-                   ular files whose names match the pattern are included. Subdi-
280                   rectories  are always included and searched recursively, sub-                   rectories  are always included and searched recursively, sub-
281                   ject to the --include_dir and --exclude_dir options. The pat-                   ject to the --include-dir and --exclude-dir options. The pat-
282                   tern is a PCRE regular expression, and is matched against the                   tern is a PCRE regular expression, and is matched against the
283                   final component of the file name (not the entire path). If  a                   final component of the file name (not the entire path). If  a
284                   file  name  matches  both  --include  and  --exclude,  it  is                   file  name  matches  both  --include  and  --exclude,  it  is
285                   excluded. There is no short form for this option.                   excluded. There is no short form for this option.
286    
287         --include_dir=pattern         --include-dir=pattern
288                   When pcregrep is searching the contents of a directory  as  a                   When pcregrep is searching the contents of a directory  as  a
289                   consequence  of  the -r (recursive search) option, only those                   consequence  of  the -r (recursive search) option, only those
290                   subdirectories whose names match the  pattern  are  included.                   subdirectories whose names match the  pattern  are  included.
291                   (Note  that  the --include option does not affect subdirecto-                   (Note  that  the --include option does not affect subdirecto-
292                   ries.) The pattern is  a  PCRE  regular  expression,  and  is                   ries.) The pattern is  a  PCRE  regular  expression,  and  is
293                   matched  against  the  final  component  of the name (not the                   matched  against  the  final  component  of the name (not the
294                   entire  path).  If   a   subdirectory   name   matches   both                   entire path). If a subdirectory name matches both  --include-
295                   --include_dir  and --exclude_dir, it is excluded. There is no                   dir and --exclude-dir, it is excluded. There is no short form
296                   short form for this option.                   for this option.
297    
298         -L, --files-without-match         -L, --files-without-match
299                   Instead of outputting lines from the files, just  output  the                   Instead of outputting lines from the files, just  output  the
# Line 516  NEWLINES Line 516  NEWLINES
516    
517  OPTIONS COMPATIBILITY  OPTIONS COMPATIBILITY
518    
519         The majority of short and long forms of pcregrep's options are the same         Many  of the short and long forms of pcregrep's options are the same as
520         as in the GNU grep program. Any long option of  the  form  --xxx-regexp         in the GNU grep program (version 2.5.4). Any long option  of  the  form
521         (GNU  terminology) is also available as --xxx-regex (PCRE terminology).         --xxx-regexp  (GNU  terminology) is also available as --xxx-regex (PCRE
522         However, the --locale, -M, --multiline, -u,  and  --utf-8  options  are         terminology). However, the --file-offsets,  --include-dir,  --line-off-
523         specific to pcregrep. If both the -c and -l options are given, GNU grep         sets, --locale, --match-limit, -M, --multiline, -N, --newline, --recur-
524         lists only file names, without counts, but pcregrep gives the counts.         sion-limit, -u, and --utf-8 options are specific to pcregrep, as is the
525           use of the --only-matching option with a capturing parentheses number.
526    
527           Although  most  of the common options work the same way, a few are dif-
528           ferent in pcregrep. For example, the --include option's argument  is  a
529           glob  for  GNU grep, but a regular expression for pcregrep. If both the
530           -c and -l options are given, GNU grep lists only  file  names,  without
531           counts, but pcregrep gives the counts.
532    
533    
534  OPTIONS WITH DATA  OPTIONS WITH DATA
535    
536         There are four different ways in which an option with data can be spec-         There are four different ways in which an option with data can be spec-
537         ified.   If  a  short  form option is used, the data may follow immedi-         ified.  If a short form option is used, the  data  may  follow  immedi-
538         ately, or in the next command line item. For example:         ately, or (with one exception) in the next command line item. For exam-
539           ple:
540    
541           -f/some/file           -f/some/file
542           -f /some/file           -f /some/file
543    
544           The exception is the -o option, which may appear with or without  data.
545           Because  of this, if data is present, it must follow immediately in the
546           same item, for example -o3.
547    
548         If a long form option is used, the data may appear in the same  command         If a long form option is used, the data may appear in the same  command
549         line item, separated by an equals character, or (with one exception) it         line  item,  separated by an equals character, or (with two exceptions)
550         may appear in the next command line item. For example:         it may appear in the next command line item. For example:
551    
552           --file=/some/file           --file=/some/file
553           --file /some/file           --file /some/file
# Line 545  OPTIONS WITH DATA Line 557  OPTIONS WITH DATA
557         directory, you must separate the file name from the option, because the         directory, you must separate the file name from the option, because the
558         shell does not treat ~ specially unless it is at the start of an item.         shell does not treat ~ specially unless it is at the start of an item.
559    
560         The  exception  to  the  above is the --colour (or --color) option, for         The  exceptions  to the above are the --colour (or --color) and --only-
561         which the data is optional. If this option does have data, it  must  be         matching options, for which the data  is  optional.  If  one  of  these
562         given  in  the first form, using an equals character. Otherwise it will         options  does  have  data, it must be given in the first form, using an
563         be assumed that it has no data.         equals character. Otherwise pcregrepP will assume that it has no data.
564    
565    
566  MATCHING ERRORS  MATCHING ERRORS
# Line 562  MATCHING ERRORS Line 574  MATCHING ERRORS
574         problem to the standard error stream. If there are more  than  20  such         problem to the standard error stream. If there are more  than  20  such
575         errors, pcregrep gives up.         errors, pcregrep gives up.
576    
577           The  --match-limit  option  of  pcregrep can be used to set the overall
578           resource limit; there is a second option called --recursion-limit  that
579           sets  a limit on the amount of memory (usually stack) that is used (see
580           the discussion of these options above).
581    
582    
583  DIAGNOSTICS  DIAGNOSTICS
584    
585         Exit status is 0 if any matches were found, 1 if no matches were found,         Exit status is 0 if any matches were found, 1 if no matches were found,
586         and 2 for syntax errors and non-existent or inacessible files (even  if         and  2 for syntax errors and non-existent or inacessible files (even if
587         matches  were  found in other files) or too many matching errors. Using         matches were found in other files) or too many matching  errors.  Using
588         the -s option to suppress error messages about inaccessble  files  does         the  -s  option to suppress error messages about inaccessble files does
589         not affect the return code.         not affect the return code.
590    
591    
# Line 586  AUTHOR Line 603  AUTHOR
603    
604  REVISION  REVISION
605    
606         Last updated: 31 October 2010         Last updated: 16 November 2010
607         Copyright (c) 1997-2010 University of Cambridge.         Copyright (c) 1997-2010 University of Cambridge.

Legend:
Removed from v.571  
changed lines
  Added in v.572

  ViewVC Help
Powered by ViewVC 1.1.5