--- embedaddon/pcre/doc/html/pcregrep.html 2012/02/21 23:05:52 1.1 +++ embedaddon/pcre/doc/html/pcregrep.html 2012/10/09 09:19:18 1.1.1.2 @@ -16,16 +16,17 @@ man page, in case the conversion went wrong.
  • SYNOPSIS
  • DESCRIPTION
  • SUPPORT FOR COMPRESSED FILES -
  • OPTIONS -
  • ENVIRONMENT VARIABLES -
  • NEWLINES -
  • OPTIONS COMPATIBILITY -
  • OPTIONS WITH DATA -
  • MATCHING ERRORS -
  • DIAGNOSTICS -
  • SEE ALSO -
  • AUTHOR -
  • REVISION +
  • BINARY FILES +
  • OPTIONS +
  • ENVIRONMENT VARIABLES +
  • NEWLINES +
  • OPTIONS COMPATIBILITY +
  • OPTIONS WITH DATA +
  • MATCHING ERRORS +
  • DIAGNOSTICS +
  • SEE ALSO +
  • AUTHOR +
  • REVISION
    SYNOPSIS

    @@ -125,8 +126,15 @@ of these file types by running it with the --help -
    OPTIONS
    +
    BINARY FILES

    +By default, a file that contains a binary zero byte within the first 1024 bytes +is identified as a binary file, and is processed specially. (GNU grep also +identifies binary files in this manner.) See the --binary-files option +for a means of changing the way binary files are handled. +

    +
    OPTIONS
    +

    The order in which some of the options appear can affect the output. For example, both the -h and -l options affect the printing of file names. Whichever comes later in the command line will be the one that takes @@ -149,6 +157,11 @@ of number is expected to be relatively small. H guarantees to have up to 8K of following text available for context output.

    +-a, --text +Treat binary files as text. This is equivalent to +--binary-files=text. +

    +

    -B number, --before-context=number Output number lines of context before each matching line. If filenames and/or line numbers are being output, a hyphen separator is used instead of a @@ -158,6 +171,18 @@ of number is expected to be relatively small. H guarantees to have up to 8K of preceding text available for context output.

    +--binary-files=word +Specify how binary files are to be processed. If the word is "binary" (the +default), pattern matching is performed on binary files, but the only output is +"Binary file <name> matches" when a match succeeds. If the word is "text", +which is equivalent to the -a or --text option, binary files are +processed in the same way as any other file. In this case, when a match +succeeds, the output may be binary garbage, which can have nasty effects if +sent to a terminal. If the word is "without-match", which is equivalent to the +-I option, binary files are not processed at all; they are assumed not to +be of interest. +

    +

    --buffer-size=number Set the parameter that controls how much memory is used for buffering files that are being scanned. @@ -269,13 +294,24 @@ each line of input. A data line is output if any of th filename can be given as "-" to refer to the standard input. When -f is used, patterns specified on the command line using -e may also be present; they are tested before the file's patterns. However, no other pattern -is taken from the command line; all arguments are treated as file names. There -is an overall maximum of 100 patterns. Trailing white space is removed from -each line, and blank lines are ignored. An empty file contains no patterns and -therefore matches nothing. See also the comments about multiple patterns versus -a single pattern with alternatives in the description of -e above. +is taken from the command line; all arguments are treated as the names of paths +to be searched. There is an overall maximum of 100 patterns. Trailing white +space is removed from each line, and blank lines are ignored. An empty file +contains no patterns and therefore matches nothing. See also the comments about +multiple patterns versus a single pattern with alternatives in the description +of -e above.

    +--file-list=filename +Read a list of files to be searched from the given file, one per line. Trailing +white space is removed from each line, and blank lines are ignored. These files +are searched before any others that may be listed on the command line. The +filename can be given as "-" to refer to the standard input. If --file +and --file-list are both specified as "-", patterns are read first. This +is useful only when the standard input is a terminal, from which further lines +(the list of files) can be read after an end-of-file indication. +

    +

    --file-offsets Instead of showing lines or parts of lines that match, show each match as an offset from the start of the file and a length, separated by a comma. In this @@ -305,6 +341,11 @@ Output a help message, giving brief details of the com type support, and then exit.

    +-I +Treat binary files as never matching. This is equivalent to +--binary-files=without-match. +

    +

    -i, --ignore-case Ignore upper/lower case distinctions during comparisons.

    @@ -537,14 +578,14 @@ a line) and in addition, require them to match entire equivalent to having ^ and $ characters at the start and end of each alternative branch in every pattern.

    -
    ENVIRONMENT VARIABLES
    +
    ENVIRONMENT VARIABLES

    The environment variables LC_ALL and LC_CTYPE are examined, in that order, for a locale. The first one that is set is used. This can be overridden by the --locale option. If no locale is set, the PCRE library's default (usually the "C" locale) is used.

    -
    NEWLINES
    +
    NEWLINES

    The -N (--newline) option allows pcregrep to scan files with different newline conventions from the default. However, the setting of this @@ -553,16 +594,17 @@ the standard error and output streams. It uses the str printf() calls to indicate newlines, relying on the C I/O library to convert this to an appropriate sequence if the output is sent to a file.

    -
    OPTIONS COMPATIBILITY
    +
    OPTIONS COMPATIBILITY

    Many of the short and long forms of pcregrep's options are the same -as in the GNU grep program (version 2.5.4). Any long option of the form +as in the GNU grep program. Any long option of the form --xxx-regexp (GNU terminology) is also available as --xxx-regex -(PCRE terminology). However, the --file-offsets, --include-dir, ---line-offsets, --locale, --match-limit, -M, ---multiline, -N, --newline, --recursion-limit, --u, and --utf-8 options are specific to pcregrep, as is the -use of the --only-matching option with a capturing parentheses number. +(PCRE terminology). However, the --file-list, --file-offsets, +--include-dir, --line-offsets, --locale, --match-limit, +-M, --multiline, -N, --newline, +--recursion-limit, -u, and --utf-8 options are specific to +pcregrep, as is the use of the --only-matching option with a +capturing parentheses number.

    Although most of the common options work the same way, a few are different in @@ -571,7 +613,7 @@ for GNU grep, but a regular expression for p -c and -l options are given, GNU grep lists only file names, without counts, but pcregrep gives the counts.

    -
    OPTIONS WITH DATA
    +
    OPTIONS WITH DATA

    There are four different ways in which an option with data can be specified. If a short form option is used, the data may follow immediately, or (with one @@ -603,7 +645,7 @@ The exceptions to the above are the --colour (o options does have data, it must be given in the first form, using an equals character. Otherwise pcregrep will assume that it has no data.

    -
    MATCHING ERRORS
    +
    MATCHING ERRORS

    It is possible to supply a regular expression that takes a very long time to fail to match certain lines. Such patterns normally involve nested indefinite @@ -619,7 +661,7 @@ resource limit; there is a second option called --r sets a limit on the amount of memory (usually stack) that is used (see the discussion of these options above).

    -
    DIAGNOSTICS
    +
    DIAGNOSTICS

    Exit status is 0 if any matches were found, 1 if no matches were found, and 2 for syntax errors, overlong lines, non-existent or inaccessible files (even if @@ -627,11 +669,11 @@ matches were found in other files) or too many matchin -s option to suppress error messages about inaccessible files does not affect the return code.

    -
    SEE ALSO
    +
    SEE ALSO

    pcrepattern(3), pcretest(1).

    -
    AUTHOR
    +
    AUTHOR

    Philip Hazel
    @@ -640,11 +682,11 @@ University Computing Service Cambridge CB2 3QH, England.

    -
    REVISION
    +
    REVISION

    -Last updated: 06 September 2011 +Last updated: 04 March 2012
    -Copyright © 1997-2011 University of Cambridge. +Copyright © 1997-2012 University of Cambridge.

    Return to the PCRE index page.