Blame doc/grep.info

Packit 709fb3
This is grep.info-t, produced by makeinfo version 6.3 from grep.texi.
Packit 709fb3
Packit 709fb3
This manual is for ‘grep’, a pattern matching engine.
Packit 709fb3
Packit 709fb3
   Copyright © 1999-2002, 2005, 2008-2017 Free Software Foundation, Inc.
Packit 709fb3
Packit 709fb3
     Permission is granted to copy, distribute and/or modify this
Packit 709fb3
     document under the terms of the GNU Free Documentation License,
Packit 709fb3
     Version 1.3 or any later version published by the Free Software
Packit 709fb3
     Foundation; with no Invariant Sections, with no Front-Cover Texts,
Packit 709fb3
     and with no Back-Cover Texts. A copy of the license is included in
Packit 709fb3
     the section entitled “GNU Free Documentation License”.
Packit 709fb3
INFO-DIR-SECTION Text creation and manipulation
Packit 709fb3
START-INFO-DIR-ENTRY
Packit 709fb3
* grep: (grep).                 Print lines matching a pattern.
Packit 709fb3
END-INFO-DIR-ENTRY
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Top,  Next: Introduction,  Up: (dir)
Packit 709fb3
Packit 709fb3
grep
Packit 709fb3
****
Packit 709fb3
Packit 709fb3
‘grep’ prints lines that contain a match for a pattern.
Packit 709fb3
Packit 709fb3
   This manual is for version 3.1 of GNU Grep.
Packit 709fb3
Packit 709fb3
   This manual is for ‘grep’, a pattern matching engine.
Packit 709fb3
Packit 709fb3
   Copyright © 1999-2002, 2005, 2008-2017 Free Software Foundation, Inc.
Packit 709fb3
Packit 709fb3
     Permission is granted to copy, distribute and/or modify this
Packit 709fb3
     document under the terms of the GNU Free Documentation License,
Packit 709fb3
     Version 1.3 or any later version published by the Free Software
Packit 709fb3
     Foundation; with no Invariant Sections, with no Front-Cover Texts,
Packit 709fb3
     and with no Back-Cover Texts.  A copy of the license is included in
Packit 709fb3
     the section entitled “GNU Free Documentation License”.
Packit 709fb3
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* Introduction::                Introduction.
Packit 709fb3
* Invoking::                    Command-line options, environment, exit status.
Packit 709fb3
* Regular Expressions::         Regular Expressions.
Packit 709fb3
* Usage::                       Examples.
Packit 709fb3
* Performance::                 Performance tuning.
Packit 709fb3
* Reporting Bugs::              Reporting Bugs.
Packit 709fb3
* Copying::                     License terms for this manual.
Packit 709fb3
* Index::                       Combined index.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Introduction,  Next: Invoking,  Prev: Top,  Up: Top
Packit 709fb3
Packit 709fb3
1 Introduction
Packit 709fb3
**************
Packit 709fb3
Packit 709fb3
‘grep’ searches input files for lines containing a match to a given
Packit 709fb3
pattern list.  When it finds a match in a line, it copies the line to
Packit 709fb3
standard output (by default), or produces whatever other sort of output
Packit 709fb3
you have requested with options.
Packit 709fb3
Packit 709fb3
   Though ‘grep’ expects to do the matching on text, it has no limits on
Packit 709fb3
input line length other than available memory, and it can match
Packit 709fb3
arbitrary characters within a line.  If the final byte of an input file
Packit 709fb3
is not a newline, ‘grep’ silently supplies one.  Since newline is also a
Packit 709fb3
separator for the list of patterns, there is no way to match newline
Packit 709fb3
characters in a text.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Invoking,  Next: Regular Expressions,  Prev: Introduction,  Up: Top
Packit 709fb3
Packit 709fb3
2 Invoking ‘grep’
Packit 709fb3
*****************
Packit 709fb3
Packit 709fb3
The general synopsis of the ‘grep’ command line is
Packit 709fb3
Packit 709fb3
     grep OPTIONS PATTERN INPUT_FILE_NAMES
Packit 709fb3
Packit 709fb3
There can be zero or more OPTIONS.  PATTERN will only be seen as such
Packit 709fb3
(and not as an INPUT_FILE_NAME) if it wasn’t already specified within
Packit 709fb3
OPTIONS (by using the ‘-e PATTERN’ or ‘-f FILE’ options).  There can be
Packit 709fb3
zero or more INPUT_FILE_NAMES.
Packit 709fb3
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* Command-line Options::        Short and long names, grouped by category.
Packit 709fb3
* Environment Variables::       POSIX, GNU generic, and GNU grep specific.
Packit 709fb3
* Exit Status::                 Exit status returned by ‘grep’.
Packit 709fb3
* grep Programs::               ‘grep’ programs.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Command-line Options,  Next: Environment Variables,  Up: Invoking
Packit 709fb3
Packit 709fb3
2.1 Command-line Options
Packit 709fb3
========================
Packit 709fb3
Packit 709fb3
‘grep’ comes with a rich set of options: some from POSIX and some being
Packit 709fb3
GNU extensions.  Long option names are always a GNU extension, even for
Packit 709fb3
options that are from POSIX specifications.  Options that are specified
Packit 709fb3
by POSIX, under their short names, are explicitly marked as such to
Packit 709fb3
facilitate POSIX-portable programming.  A few option names are provided
Packit 709fb3
for compatibility with older or more exotic implementations.
Packit 709fb3
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* Generic Program Information::
Packit 709fb3
* Matching Control::
Packit 709fb3
* General Output Control::
Packit 709fb3
* Output Line Prefix Control::
Packit 709fb3
* Context Line Control::
Packit 709fb3
* File and Directory Selection::
Packit 709fb3
* Other Options::
Packit 709fb3
Packit 709fb3
   Several additional options control which variant of the ‘grep’
Packit 709fb3
matching engine is used.  *Note grep Programs::.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Generic Program Information,  Next: Matching Control,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.1 Generic Program Information
Packit 709fb3
---------------------------------
Packit 709fb3
Packit 709fb3
‘--help’
Packit 709fb3
     Print a usage message briefly summarizing the command-line options
Packit 709fb3
     and the bug-reporting address, then exit.
Packit 709fb3
Packit 709fb3
‘-V’
Packit 709fb3
‘--version’
Packit 709fb3
     Print the version number of ‘grep’ to the standard output stream.
Packit 709fb3
     This version number should be included in all bug reports.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Matching Control,  Next: General Output Control,  Prev: Generic Program Information,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.2 Matching Control
Packit 709fb3
----------------------
Packit 709fb3
Packit 709fb3
‘-e PATTERN’
Packit 709fb3
‘--regexp=PATTERN’
Packit 709fb3
     Use PATTERN as the pattern.  If this option is used multiple times
Packit 709fb3
     or is combined with the ‘-f’ (‘--file’) option, search for all
Packit 709fb3
     patterns given.  (‘-e’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-f FILE’
Packit 709fb3
‘--file=FILE’
Packit 709fb3
     Obtain patterns from FILE, one per line.  If this option is used
Packit 709fb3
     multiple times or is combined with the ‘-e’ (‘--regexp’) option,
Packit 709fb3
     search for all patterns given.  The empty file contains zero
Packit 709fb3
     patterns, and therefore matches nothing.  (‘-f’ is specified by
Packit 709fb3
     POSIX.)
Packit 709fb3
Packit 709fb3
‘-i’
Packit 709fb3
‘-y’
Packit 709fb3
‘--ignore-case’
Packit 709fb3
     Ignore case distinctions, so that characters that differ only in
Packit 709fb3
     case match each other.  Although this is straightforward when
Packit 709fb3
     letters differ in case only via lowercase-uppercase pairs, the
Packit 709fb3
     behavior is unspecified in other situations.  For example,
Packit 709fb3
     uppercase “S” has an unusual lowercase counterpart “ſ” (Unicode
Packit 709fb3
     character U+017F, LATIN SMALL LETTER LONG S) in many locales, and
Packit 709fb3
     it is unspecified whether this unusual character matches “S” or “s”
Packit 709fb3
     even though uppercasing it yields “S”.  Another example: the
Packit 709fb3
     lowercase German letter “ß” (U+00DF, LATIN SMALL LETTER SHARP S) is
Packit 709fb3
     normally capitalized as the two-character string “SS” but it does
Packit 709fb3
     not match “SS”, and it might not match the uppercase letter “ẞ”
Packit 709fb3
     (U+1E9E, LATIN CAPITAL LETTER SHARP S) even though lowercasing the
Packit 709fb3
     latter yields the former.
Packit 709fb3
Packit 709fb3
     ‘-y’ is an obsolete synonym that is provided for compatibility.
Packit 709fb3
     (‘-i’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-v’
Packit 709fb3
‘--invert-match’
Packit 709fb3
     Invert the sense of matching, to select non-matching lines.  (‘-v’
Packit 709fb3
     is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-w’
Packit 709fb3
‘--word-regexp’
Packit 709fb3
     Select only those lines containing matches that form whole words.
Packit 709fb3
     The test is that the matching substring must either be at the
Packit 709fb3
     beginning of the line, or preceded by a non-word constituent
Packit 709fb3
     character.  Similarly, it must be either at the end of the line or
Packit 709fb3
     followed by a non-word constituent character.  Word-constituent
Packit 709fb3
     characters are letters, digits, and the underscore.  This option
Packit 709fb3
     has no effect if ‘-x’ is also specified.
Packit 709fb3
Packit 709fb3
‘-x’
Packit 709fb3
‘--line-regexp’
Packit 709fb3
     Select only those matches that exactly match the whole line.  For a
Packit 709fb3
     regular expression pattern, this is like parenthesizing the pattern
Packit 709fb3
     and then surrounding it with ‘^’ and ‘$’.  (‘-x’ is specified by
Packit 709fb3
     POSIX.)
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: General Output Control,  Next: Output Line Prefix Control,  Prev: Matching Control,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.3 General Output Control
Packit 709fb3
----------------------------
Packit 709fb3
Packit 709fb3
‘-c’
Packit 709fb3
‘--count’
Packit 709fb3
     Suppress normal output; instead print a count of matching lines for
Packit 709fb3
     each input file.  With the ‘-v’ (‘--invert-match’) option, count
Packit 709fb3
     non-matching lines.  (‘-c’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘--color[=WHEN]’
Packit 709fb3
‘--colour[=WHEN]’
Packit 709fb3
     Surround the matched (non-empty) strings, matching lines, context
Packit 709fb3
     lines, file names, line numbers, byte offsets, and separators (for
Packit 709fb3
     fields and groups of context lines) with escape sequences to
Packit 709fb3
     display them in color on the terminal.  The colors are defined by
Packit 709fb3
     the environment variable ‘GREP_COLORS’ and default to
Packit 709fb3
     ‘ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36’ for bold red
Packit 709fb3
     matched text, magenta file names, green line numbers, green byte
Packit 709fb3
     offsets, cyan separators, and default terminal colors otherwise.
Packit 709fb3
     The deprecated environment variable ‘GREP_COLOR’ is still
Packit 709fb3
     supported, but its setting does not have priority; it defaults to
Packit 709fb3
     ‘01;31’ (bold red) which only covers the color for matched text.
Packit 709fb3
     WHEN is ‘never’, ‘always’, or ‘auto’.
Packit 709fb3
Packit 709fb3
‘-L’
Packit 709fb3
‘--files-without-match’
Packit 709fb3
     Suppress normal output; instead print the name of each input file
Packit 709fb3
     from which no output would normally have been printed.  The
Packit 709fb3
     scanning of each file stops on the first match.
Packit 709fb3
Packit 709fb3
‘-l’
Packit 709fb3
‘--files-with-matches’
Packit 709fb3
     Suppress normal output; instead print the name of each input file
Packit 709fb3
     from which output would normally have been printed.  The scanning
Packit 709fb3
     of each file stops on the first match.  (‘-l’ is specified by
Packit 709fb3
     POSIX.)
Packit 709fb3
Packit 709fb3
‘-m NUM’
Packit 709fb3
‘--max-count=NUM’
Packit 709fb3
     Stop after the first NUM selected lines.  If the input is standard
Packit 709fb3
     input from a regular file, and NUM selected lines are output,
Packit 709fb3
     ‘grep’ ensures that the standard input is positioned just after the
Packit 709fb3
     last selected line before exiting, regardless of the presence of
Packit 709fb3
     trailing context lines.  This enables a calling process to resume a
Packit 709fb3
     search.  For example, the following shell script makes use of it:
Packit 709fb3
Packit 709fb3
          while grep -m 1 PATTERN
Packit 709fb3
          do
Packit 709fb3
            echo xxxx
Packit 709fb3
          done < FILE
Packit 709fb3
Packit 709fb3
     But the following probably will not work because a pipe is not a
Packit 709fb3
     regular file:
Packit 709fb3
Packit 709fb3
          # This probably will not work.
Packit 709fb3
          cat FILE |
Packit 709fb3
          while grep -m 1 PATTERN
Packit 709fb3
          do
Packit 709fb3
            echo xxxx
Packit 709fb3
          done
Packit 709fb3
Packit 709fb3
     When ‘grep’ stops after NUM selected lines, it outputs any trailing
Packit 709fb3
     context lines.  When the ‘-c’ or ‘--count’ option is also used,
Packit 709fb3
     ‘grep’ does not output a count greater than NUM.  When the ‘-v’ or
Packit 709fb3
     ‘--invert-match’ option is also used, ‘grep’ stops after outputting
Packit 709fb3
     NUM non-matching lines.
Packit 709fb3
Packit 709fb3
‘-o’
Packit 709fb3
‘--only-matching’
Packit 709fb3
     Print only the matched (non-empty) parts of matching lines, with
Packit 709fb3
     each such part on a separate output line.  Output lines use the
Packit 709fb3
     same delimiters as input, and delimiters are null bytes if ‘-z’
Packit 709fb3
     (‘--null-data’) is also used (*note Other Options::).
Packit 709fb3
Packit 709fb3
‘-q’
Packit 709fb3
‘--quiet’
Packit 709fb3
‘--silent’
Packit 709fb3
     Quiet; do not write anything to standard output.  Exit immediately
Packit 709fb3
     with zero status if any match is found, even if an error was
Packit 709fb3
     detected.  Also see the ‘-s’ or ‘--no-messages’ option.  (‘-q’ is
Packit 709fb3
     specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-s’
Packit 709fb3
‘--no-messages’
Packit 709fb3
     Suppress error messages about nonexistent or unreadable files.
Packit 709fb3
     Portability note: unlike GNU ‘grep’, 7th Edition Unix ‘grep’ did
Packit 709fb3
     not conform to POSIX, because it lacked ‘-q’ and its ‘-s’ option
Packit 709fb3
     behaved like GNU ‘grep’’s ‘-q’ option.(1)  USG-style ‘grep’ also
Packit 709fb3
     lacked ‘-q’ but its ‘-s’ option behaved like GNU ‘grep’’s.
Packit 709fb3
     Portable shell scripts should avoid both ‘-q’ and ‘-s’ and should
Packit 709fb3
     redirect standard and error output to ‘/dev/null’ instead.  (‘-s’
Packit 709fb3
     is specified by POSIX.)
Packit 709fb3
Packit 709fb3
   ---------- Footnotes ----------
Packit 709fb3
Packit 709fb3
   (1) Of course, 7th Edition Unix predated POSIX by several years!
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Output Line Prefix Control,  Next: Context Line Control,  Prev: General Output Control,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.4 Output Line Prefix Control
Packit 709fb3
--------------------------------
Packit 709fb3
Packit 709fb3
When several prefix fields are to be output, the order is always file
Packit 709fb3
name, line number, and byte offset, regardless of the order in which
Packit 709fb3
these options were specified.
Packit 709fb3
Packit 709fb3
‘-b’
Packit 709fb3
‘--byte-offset’
Packit 709fb3
     Print the 0-based byte offset within the input file before each
Packit 709fb3
     line of output.  If ‘-o’ (‘--only-matching’) is specified, print
Packit 709fb3
     the offset of the matching part itself.
Packit 709fb3
Packit 709fb3
‘-H’
Packit 709fb3
‘--with-filename’
Packit 709fb3
     Print the file name for each match.  This is the default when there
Packit 709fb3
     is more than one file to search.
Packit 709fb3
Packit 709fb3
‘-h’
Packit 709fb3
‘--no-filename’
Packit 709fb3
     Suppress the prefixing of file names on output.  This is the
Packit 709fb3
     default when there is only one file (or only standard input) to
Packit 709fb3
     search.
Packit 709fb3
Packit 709fb3
‘--label=LABEL’
Packit 709fb3
     Display input actually coming from standard input as input coming
Packit 709fb3
     from file LABEL.  This is especially useful when implementing tools
Packit 709fb3
     like ‘zgrep’; e.g.:
Packit 709fb3
Packit 709fb3
          gzip -cd foo.gz | grep --label=foo -H something
Packit 709fb3
Packit 709fb3
‘-n’
Packit 709fb3
‘--line-number’
Packit 709fb3
     Prefix each line of output with the 1-based line number within its
Packit 709fb3
     input file.  (‘-n’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-T’
Packit 709fb3
‘--initial-tab’
Packit 709fb3
     Make sure that the first character of actual line content lies on a
Packit 709fb3
     tab stop, so that the alignment of tabs looks normal.  This is
Packit 709fb3
     useful with options that prefix their output to the actual content:
Packit 709fb3
     ‘-H’, ‘-n’, and ‘-b’.  This may also prepend spaces to output line
Packit 709fb3
     numbers and byte offsets so that lines from a single file all start
Packit 709fb3
     at the same column.
Packit 709fb3
Packit 709fb3
‘-Z’
Packit 709fb3
‘--null’
Packit 709fb3
     Output a zero byte (the ASCII NUL character) instead of the
Packit 709fb3
     character that normally follows a file name.  For example, ‘grep
Packit 709fb3
     -lZ’ outputs a zero byte after each file name instead of the usual
Packit 709fb3
     newline.  This option makes the output unambiguous, even in the
Packit 709fb3
     presence of file names containing unusual characters like newlines.
Packit 709fb3
     This option can be used with commands like ‘find -print0’, ‘perl
Packit 709fb3
     -0’, ‘sort -z’, and ‘xargs -0’ to process arbitrary file names,
Packit 709fb3
     even those that contain newline characters.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Context Line Control,  Next: File and Directory Selection,  Prev: Output Line Prefix Control,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.5 Context Line Control
Packit 709fb3
--------------------------
Packit 709fb3
Packit 709fb3
“Context lines” are non-matching lines that are near a matching line.
Packit 709fb3
They are output only if one of the following options are used.
Packit 709fb3
Regardless of how these options are set, ‘grep’ never outputs any given
Packit 709fb3
line more than once.  If the ‘-o’ (‘--only-matching’) option is
Packit 709fb3
specified, these options have no effect and a warning is given upon
Packit 709fb3
their use.
Packit 709fb3
Packit 709fb3
‘-A NUM’
Packit 709fb3
‘--after-context=NUM’
Packit 709fb3
     Print NUM lines of trailing context after matching lines.
Packit 709fb3
Packit 709fb3
‘-B NUM’
Packit 709fb3
‘--before-context=NUM’
Packit 709fb3
     Print NUM lines of leading context before matching lines.
Packit 709fb3
Packit 709fb3
‘-C NUM’
Packit 709fb3
‘-NUM’
Packit 709fb3
‘--context=NUM’
Packit 709fb3
     Print NUM lines of leading and trailing output context.
Packit 709fb3
Packit 709fb3
‘--group-separator=STRING’
Packit 709fb3
     When ‘-A’, ‘-B’ or ‘-C’ are in use, print STRING instead of ‘--’
Packit 709fb3
     between groups of lines.
Packit 709fb3
Packit 709fb3
‘--no-group-separator’
Packit 709fb3
     When ‘-A’, ‘-B’ or ‘-C’ are in use, do not print a separator
Packit 709fb3
     between groups of lines.
Packit 709fb3
Packit 709fb3
   Here are some points about how ‘grep’ chooses the separator to print
Packit 709fb3
between prefix fields and line content:
Packit 709fb3
Packit 709fb3
   • Matching lines normally use ‘:’ as a separator between prefix
Packit 709fb3
     fields and actual line content.
Packit 709fb3
Packit 709fb3
   • Context (i.e., non-matching) lines use ‘-’ instead.
Packit 709fb3
Packit 709fb3
   • When context is not specified, matching lines are simply output one
Packit 709fb3
     right after another.
Packit 709fb3
Packit 709fb3
   • When context is specified, lines that are adjacent in the input
Packit 709fb3
     form a group and are output one right after another, while by
Packit 709fb3
     default a separator appears between non-adjacent groups.
Packit 709fb3
Packit 709fb3
   • The default separator is a ‘--’ line; its presence and appearance
Packit 709fb3
     can be changed with the options above.
Packit 709fb3
Packit 709fb3
   • Each group may contain several matching lines when they are close
Packit 709fb3
     enough to each other that two adjacent groups connect and can merge
Packit 709fb3
     into a single contiguous one.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: File and Directory Selection,  Next: Other Options,  Prev: Context Line Control,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.6 File and Directory Selection
Packit 709fb3
----------------------------------
Packit 709fb3
Packit 709fb3
‘-a’
Packit 709fb3
‘--text’
Packit 709fb3
     Process a binary file as if it were text; this is equivalent to the
Packit 709fb3
     ‘--binary-files=text’ option.
Packit 709fb3
Packit 709fb3
‘--binary-files=TYPE’
Packit 709fb3
     If a file’s data or metadata indicate that the file contains binary
Packit 709fb3
     data, assume that the file is of type TYPE.  Non-text bytes
Packit 709fb3
     indicate binary data; these are either output bytes that are
Packit 709fb3
     improperly encoded for the current locale (*note Environment
Packit 709fb3
     Variables::), or null input bytes when the ‘-z’ (‘--null-data’)
Packit 709fb3
     option is not given (*note Other Options::).
Packit 709fb3
Packit 709fb3
     By default, TYPE is ‘binary’, and ‘grep’ suppresses output after
Packit 709fb3
     null input binary data is discovered, and suppresses output lines
Packit 709fb3
     that contain improperly encoded data.  When some output is
Packit 709fb3
     suppressed, ‘grep’ follows any output with a one-line message
Packit 709fb3
     saying that a binary file matches.
Packit 709fb3
Packit 709fb3
     If TYPE is ‘without-match’, when ‘grep’ discovers null input binary
Packit 709fb3
     data it assumes that the rest of the file does not match; this is
Packit 709fb3
     equivalent to the ‘-I’ option.
Packit 709fb3
Packit 709fb3
     If TYPE is ‘text’, ‘grep’ processes binary data as if it were text;
Packit 709fb3
     this is equivalent to the ‘-a’ option.
Packit 709fb3
Packit 709fb3
     When TYPE is ‘binary’, ‘grep’ may treat non-text bytes as line
Packit 709fb3
     terminators even without the ‘-z’ (‘--null-data’) option.  This
Packit 709fb3
     means choosing ‘binary’ versus ‘text’ can affect whether a pattern
Packit 709fb3
     matches a file.  For example, when TYPE is ‘binary’ the pattern
Packit 709fb3
     ‘q$’ might match ‘q’ immediately followed by a null byte, even
Packit 709fb3
     though this is not matched when TYPE is ‘text’.  Conversely, when
Packit 709fb3
     TYPE is ‘binary’ the pattern ‘.’ (period) might not match a null
Packit 709fb3
     byte.
Packit 709fb3
Packit 709fb3
     _Warning:_ The ‘-a’ (‘--binary-files=text’) option might output
Packit 709fb3
     binary garbage, which can have nasty side effects if the output is
Packit 709fb3
     a terminal and if the terminal driver interprets some of it as
Packit 709fb3
     commands.  On the other hand, when reading files whose text
Packit 709fb3
     encodings are unknown, it can be helpful to use ‘-a’ or to set
Packit 709fb3
     ‘LC_ALL='C'’ in the environment, in order to find more matches even
Packit 709fb3
     if the matches are unsafe for direct display.
Packit 709fb3
Packit 709fb3
‘-D ACTION’
Packit 709fb3
‘--devices=ACTION’
Packit 709fb3
     If an input file is a device, FIFO, or socket, use ACTION to
Packit 709fb3
     process it.  If ACTION is ‘read’, all devices are read just as if
Packit 709fb3
     they were ordinary files.  If ACTION is ‘skip’, devices, FIFOs, and
Packit 709fb3
     sockets are silently skipped.  By default, devices are read if they
Packit 709fb3
     are on the command line or if the ‘-R’ (‘--dereference-recursive’)
Packit 709fb3
     option is used, and are skipped if they are encountered recursively
Packit 709fb3
     and the ‘-r’ (‘--recursive’) option is used.  This option has no
Packit 709fb3
     effect on a file that is read via standard input.
Packit 709fb3
Packit 709fb3
‘-d ACTION’
Packit 709fb3
‘--directories=ACTION’
Packit 709fb3
     If an input file is a directory, use ACTION to process it.  By
Packit 709fb3
     default, ACTION is ‘read’, which means that directories are read
Packit 709fb3
     just as if they were ordinary files (some operating systems and
Packit 709fb3
     file systems disallow this, and will cause ‘grep’ to print error
Packit 709fb3
     messages for every directory or silently skip them).  If ACTION is
Packit 709fb3
     ‘skip’, directories are silently skipped.  If ACTION is ‘recurse’,
Packit 709fb3
     ‘grep’ reads all files under each directory, recursively, following
Packit 709fb3
     command-line symbolic links and skipping other symlinks; this is
Packit 709fb3
     equivalent to the ‘-r’ option.
Packit 709fb3
Packit 709fb3
‘--exclude=GLOB’
Packit 709fb3
     Skip any command-line file with a name suffix that matches the
Packit 709fb3
     pattern GLOB, using wildcard matching; a name suffix is either the
Packit 709fb3
     whole name, or any suffix starting after a ‘/’ and before a
Packit 709fb3
     non-‘/’.  When searching recursively, skip any subfile whose base
Packit 709fb3
     name matches GLOB; the base name is the part after the last ‘/’.  A
Packit 709fb3
     pattern can use ‘*’, ‘?’, and ‘[’...‘]’  as wildcards, and ‘\’ to
Packit 709fb3
     quote a wildcard or backslash character literally.
Packit 709fb3
Packit 709fb3
‘--exclude-from=FILE’
Packit 709fb3
     Skip files whose name matches any of the patterns read from FILE
Packit 709fb3
     (using wildcard matching as described under ‘--exclude’).
Packit 709fb3
Packit 709fb3
‘--exclude-dir=GLOB’
Packit 709fb3
     Skip any command-line directory with a name suffix that matches the
Packit 709fb3
     pattern GLOB.  When searching recursively, skip any subdirectory
Packit 709fb3
     whose base name matches GLOB.  Ignore any redundant trailing
Packit 709fb3
     slashes in GLOB.
Packit 709fb3
Packit 709fb3
‘-I’
Packit 709fb3
     Process a binary file as if it did not contain matching data; this
Packit 709fb3
     is equivalent to the ‘--binary-files=without-match’ option.
Packit 709fb3
Packit 709fb3
‘--include=GLOB’
Packit 709fb3
     Search only files whose name matches GLOB, using wildcard matching
Packit 709fb3
     as described under ‘--exclude’.
Packit 709fb3
Packit 709fb3
‘-r’
Packit 709fb3
‘--recursive’
Packit 709fb3
     For each directory operand, read and process all files in that
Packit 709fb3
     directory, recursively.  Follow symbolic links on the command line,
Packit 709fb3
     but skip symlinks that are encountered recursively.  Note that if
Packit 709fb3
     no file operand is given, grep searches the working directory.
Packit 709fb3
     This is the same as the ‘--directories=recurse’ option.
Packit 709fb3
Packit 709fb3
‘-R’
Packit 709fb3
‘--dereference-recursive’
Packit 709fb3
     For each directory operand, read and process all files in that
Packit 709fb3
     directory, recursively, following all symbolic links.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Other Options,  Prev: File and Directory Selection,  Up: Command-line Options
Packit 709fb3
Packit 709fb3
2.1.7 Other Options
Packit 709fb3
-------------------
Packit 709fb3
Packit 709fb3
‘--line-buffered’
Packit 709fb3
     Use line buffering on output.  This can cause a performance
Packit 709fb3
     penalty.
Packit 709fb3
Packit 709fb3
‘-U’
Packit 709fb3
‘--binary’
Packit 709fb3
     On platforms that distinguish between text and binary I/O, use the
Packit 709fb3
     latter when reading and writing files other than the user’s
Packit 709fb3
     terminal, so that all input bytes are read and written as-is.  This
Packit 709fb3
     overrides the default behavior where ‘grep’ follows the operating
Packit 709fb3
     system’s advice whether to use text or binary I/O.  On MS-Windows
Packit 709fb3
     when ‘grep’ uses text I/O it reads a carriage return–newline pair
Packit 709fb3
     as a newline and a Control-Z as end-of-file, and it writes a
Packit 709fb3
     newline as a carriage return–newline pair.
Packit 709fb3
Packit 709fb3
     When using text I/O ‘--byte-offset’ (‘-b’) counts and
Packit 709fb3
     ‘--binary-files’ heuristics apply to input data after text-I/O
Packit 709fb3
     processing.  Also, the ‘--binary-files’ heuristics need not agree
Packit 709fb3
     with the ‘--binary’ option; that is, they may treat the data as
Packit 709fb3
     text even if ‘--binary’ is given, or vice versa.  *Note File and
Packit 709fb3
     Directory Selection::.
Packit 709fb3
Packit 709fb3
     This option has no effect on GNU and other POSIX-compatible
Packit 709fb3
     platforms, which do not distinguish text from binary I/O.
Packit 709fb3
Packit 709fb3
‘-z’
Packit 709fb3
‘--null-data’
Packit 709fb3
     Treat input and output data as sequences of lines, each terminated
Packit 709fb3
     by a zero byte (the ASCII NUL character) instead of a newline.
Packit 709fb3
     Like the ‘-Z’ or ‘--null’ option, this option can be used with
Packit 709fb3
     commands like ‘sort -z’ to process arbitrary file names.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Environment Variables,  Next: Exit Status,  Prev: Command-line Options,  Up: Invoking
Packit 709fb3
Packit 709fb3
2.2 Environment Variables
Packit 709fb3
=========================
Packit 709fb3
Packit 709fb3
The behavior of ‘grep’ is affected by the following environment
Packit 709fb3
variables.
Packit 709fb3
Packit 709fb3
   The locale for category ‘LC_FOO’ is specified by examining the three
Packit 709fb3
environment variables ‘LC_ALL’, ‘LC_FOO’, and ‘LANG’, in that order.
Packit 709fb3
The first of these variables that is set specifies the locale.  For
Packit 709fb3
example, if ‘LC_ALL’ is not set, but ‘LC_COLLATE’ is set to ‘pt_BR’,
Packit 709fb3
then the Brazilian Portuguese locale is used for the ‘LC_COLLATE’
Packit 709fb3
category.  As a special case for ‘LC_MESSAGES’ only, the environment
Packit 709fb3
variable ‘LANGUAGE’ can contain a colon-separated list of languages that
Packit 709fb3
overrides the three environment variables that ordinarily specify the
Packit 709fb3
‘LC_MESSAGES’ category.  The ‘C’ locale is used if none of these
Packit 709fb3
environment variables are set, if the locale catalog is not installed,
Packit 709fb3
or if ‘grep’ was not compiled with national language support (NLS). The
Packit 709fb3
shell command ‘locale -a’ lists locales that are currently available.
Packit 709fb3
Packit 709fb3
   Many of the environment variables in the following list let you
Packit 709fb3
control highlighting using Select Graphic Rendition (SGR) commands
Packit 709fb3
interpreted by the terminal or terminal emulator.  (See the section in
Packit 709fb3
the documentation of your text terminal for permitted values and their
Packit 709fb3
meanings as character attributes.)  These substring values are integers
Packit 709fb3
in decimal representation and can be concatenated with semicolons.
Packit 709fb3
‘grep’ takes care of assembling the result into a complete SGR sequence
Packit 709fb3
(‘\33[’...‘m’).  Common values to concatenate include ‘1’ for bold, ‘4’
Packit 709fb3
for underline, ‘5’ for blink, ‘7’ for inverse, ‘39’ for default
Packit 709fb3
foreground color, ‘30’ to ‘37’ for foreground colors, ‘90’ to ‘97’ for
Packit 709fb3
16-color mode foreground colors, ‘38;5;0’ to ‘38;5;255’ for 88-color and
Packit 709fb3
256-color modes foreground colors, ‘49’ for default background color,
Packit 709fb3
‘40’ to ‘47’ for background colors, ‘100’ to ‘107’ for 16-color mode
Packit 709fb3
background colors, and ‘48;5;0’ to ‘48;5;255’ for 88-color and 256-color
Packit 709fb3
modes background colors.
Packit 709fb3
Packit 709fb3
   The two-letter names used in the ‘GREP_COLORS’ environment variable
Packit 709fb3
(and some of the others) refer to terminal “capabilities,” the ability
Packit 709fb3
of a terminal to highlight text, or change its color, and so on.  These
Packit 709fb3
capabilities are stored in an online database and accessed by the
Packit 709fb3
‘terminfo’ library.
Packit 709fb3
Packit 709fb3
‘GREP_OPTIONS’
Packit 709fb3
     This variable specifies default options to be placed in front of
Packit 709fb3
     any explicit options.  As this causes problems when writing
Packit 709fb3
     portable scripts, this feature will be removed in a future release
Packit 709fb3
     of ‘grep’, and ‘grep’ warns if it is used.  Please use an alias or
Packit 709fb3
     script instead.  For example, if ‘grep’ is in the directory
Packit 709fb3
     ‘/usr/bin’ you can prepend ‘$HOME/bin’ to your ‘PATH’ and create an
Packit 709fb3
     executable script ‘$HOME/bin/grep’ containing the following:
Packit 709fb3
Packit 709fb3
          #! /bin/sh
Packit 709fb3
          export PATH=/usr/bin
Packit 709fb3
          exec grep --color=auto --devices=skip "$@"
Packit 709fb3
Packit 709fb3
‘GREP_COLOR’
Packit 709fb3
     This variable specifies the color used to highlight matched
Packit 709fb3
     (non-empty) text.  It is deprecated in favor of ‘GREP_COLORS’, but
Packit 709fb3
     still supported.  The ‘mt’, ‘ms’, and ‘mc’ capabilities of
Packit 709fb3
     ‘GREP_COLORS’ have priority over it.  It can only specify the color
Packit 709fb3
     used to highlight the matching non-empty text in any matching line
Packit 709fb3
     (a selected line when the ‘-v’ command-line option is omitted, or a
Packit 709fb3
     context line when ‘-v’ is specified).  The default is ‘01;31’,
Packit 709fb3
     which means a bold red foreground text on the terminal’s default
Packit 709fb3
     background.
Packit 709fb3
Packit 709fb3
‘GREP_COLORS’
Packit 709fb3
     This variable specifies the colors and other attributes used to
Packit 709fb3
     highlight various parts of the output.  Its value is a
Packit 709fb3
     colon-separated list of ‘terminfo’ capabilities that defaults to
Packit 709fb3
     ‘ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36’ with the ‘rv’
Packit 709fb3
     and ‘ne’ boolean capabilities omitted (i.e., false).  Supported
Packit 709fb3
     capabilities are as follows.
Packit 709fb3
Packit 709fb3
     ‘sl=’
Packit 709fb3
          SGR substring for whole selected lines (i.e., matching lines
Packit 709fb3
          when the ‘-v’ command-line option is omitted, or non-matching
Packit 709fb3
          lines when ‘-v’ is specified).  If however the boolean ‘rv’
Packit 709fb3
          capability and the ‘-v’ command-line option are both
Packit 709fb3
          specified, it applies to context matching lines instead.  The
Packit 709fb3
          default is empty (i.e., the terminal’s default color pair).
Packit 709fb3
Packit 709fb3
     ‘cx=’
Packit 709fb3
          SGR substring for whole context lines (i.e., non-matching
Packit 709fb3
          lines when the ‘-v’ command-line option is omitted, or
Packit 709fb3
          matching lines when ‘-v’ is specified).  If however the
Packit 709fb3
          boolean ‘rv’ capability and the ‘-v’ command-line option are
Packit 709fb3
          both specified, it applies to selected non-matching lines
Packit 709fb3
          instead.  The default is empty (i.e., the terminal’s default
Packit 709fb3
          color pair).
Packit 709fb3
Packit 709fb3
     ‘rv’
Packit 709fb3
          Boolean value that reverses (swaps) the meanings of the ‘sl=’
Packit 709fb3
          and ‘cx=’ capabilities when the ‘-v’ command-line option is
Packit 709fb3
          specified.  The default is false (i.e., the capability is
Packit 709fb3
          omitted).
Packit 709fb3
Packit 709fb3
     ‘mt=01;31’
Packit 709fb3
          SGR substring for matching non-empty text in any matching line
Packit 709fb3
          (i.e., a selected line when the ‘-v’ command-line option is
Packit 709fb3
          omitted, or a context line when ‘-v’ is specified).  Setting
Packit 709fb3
          this is equivalent to setting both ‘ms=’ and ‘mc=’ at once to
Packit 709fb3
          the same value.  The default is a bold red text foreground
Packit 709fb3
          over the current line background.
Packit 709fb3
Packit 709fb3
     ‘ms=01;31’
Packit 709fb3
          SGR substring for matching non-empty text in a selected line.
Packit 709fb3
          (This is used only when the ‘-v’ command-line option is
Packit 709fb3
          omitted.)  The effect of the ‘sl=’ (or ‘cx=’ if ‘rv’)
Packit 709fb3
          capability remains active when this takes effect.  The default
Packit 709fb3
          is a bold red text foreground over the current line
Packit 709fb3
          background.
Packit 709fb3
Packit 709fb3
     ‘mc=01;31’
Packit 709fb3
          SGR substring for matching non-empty text in a context line.
Packit 709fb3
          (This is used only when the ‘-v’ command-line option is
Packit 709fb3
          specified.)  The effect of the ‘cx=’ (or ‘sl=’ if ‘rv’)
Packit 709fb3
          capability remains active when this takes effect.  The default
Packit 709fb3
          is a bold red text foreground over the current line
Packit 709fb3
          background.
Packit 709fb3
Packit 709fb3
     ‘fn=35’
Packit 709fb3
          SGR substring for file names prefixing any content line.  The
Packit 709fb3
          default is a magenta text foreground over the terminal’s
Packit 709fb3
          default background.
Packit 709fb3
Packit 709fb3
     ‘ln=32’
Packit 709fb3
          SGR substring for line numbers prefixing any content line.
Packit 709fb3
          The default is a green text foreground over the terminal’s
Packit 709fb3
          default background.
Packit 709fb3
Packit 709fb3
     ‘bn=32’
Packit 709fb3
          SGR substring for byte offsets prefixing any content line.
Packit 709fb3
          The default is a green text foreground over the terminal’s
Packit 709fb3
          default background.
Packit 709fb3
Packit 709fb3
     ‘se=36’
Packit 709fb3
          SGR substring for separators that are inserted between
Packit 709fb3
          selected line fields (‘:’), between context line fields (‘-’),
Packit 709fb3
          and between groups of adjacent lines when nonzero context is
Packit 709fb3
          specified (‘--’).  The default is a cyan text foreground over
Packit 709fb3
          the terminal’s default background.
Packit 709fb3
Packit 709fb3
     ‘ne’
Packit 709fb3
          Boolean value that prevents clearing to the end of line using
Packit 709fb3
          Erase in Line (EL) to Right (‘\33[K’) each time a colorized
Packit 709fb3
          item ends.  This is needed on terminals on which EL is not
Packit 709fb3
          supported.  It is otherwise useful on terminals for which the
Packit 709fb3
          ‘back_color_erase’ (‘bce’) boolean ‘terminfo’ capability does
Packit 709fb3
          not apply, when the chosen highlight colors do not affect the
Packit 709fb3
          background, or when EL is too slow or causes too much flicker.
Packit 709fb3
          The default is false (i.e., the capability is omitted).
Packit 709fb3
Packit 709fb3
     Note that boolean capabilities have no ‘=’...  part.  They are
Packit 709fb3
     omitted (i.e., false) by default and become true when specified.
Packit 709fb3
Packit 709fb3
‘LC_ALL’
Packit 709fb3
‘LC_COLLATE’
Packit 709fb3
‘LANG’
Packit 709fb3
     These variables specify the locale for the ‘LC_COLLATE’ category,
Packit 709fb3
     which might affect how range expressions like ‘[a-z]’ are
Packit 709fb3
     interpreted.
Packit 709fb3
Packit 709fb3
‘LC_ALL’
Packit 709fb3
‘LC_CTYPE’
Packit 709fb3
‘LANG’
Packit 709fb3
     These variables specify the locale for the ‘LC_CTYPE’ category,
Packit 709fb3
     which determines the type of characters, e.g., which characters are
Packit 709fb3
     whitespace.  This category also determines the character encoding,
Packit 709fb3
     that is, whether text is encoded in UTF-8, ASCII, or some other
Packit 709fb3
     encoding.  In the ‘C’ or ‘POSIX’ locale, all characters are encoded
Packit 709fb3
     as a single byte and every byte is a valid character.
Packit 709fb3
Packit 709fb3
‘LANGUAGE’
Packit 709fb3
‘LC_ALL’
Packit 709fb3
‘LC_MESSAGES’
Packit 709fb3
‘LANG’
Packit 709fb3
     These variables specify the locale for the ‘LC_MESSAGES’ category,
Packit 709fb3
     which determines the language that ‘grep’ uses for messages.  The
Packit 709fb3
     default ‘C’ locale uses American English messages.
Packit 709fb3
Packit 709fb3
‘POSIXLY_CORRECT’
Packit 709fb3
     If set, ‘grep’ behaves as POSIX requires; otherwise, ‘grep’ behaves
Packit 709fb3
     more like other GNU programs.  POSIX requires that options that
Packit 709fb3
     follow file names must be treated as file names; by default, such
Packit 709fb3
     options are permuted to the front of the operand list and are
Packit 709fb3
     treated as options.  Also, ‘POSIXLY_CORRECT’ disables special
Packit 709fb3
     handling of an invalid bracket expression.  *Note
Packit 709fb3
     invalid-bracket-expr::.
Packit 709fb3
Packit 709fb3
‘_N_GNU_nonoption_argv_flags_’
Packit 709fb3
     (Here ‘N’ is ‘grep’’s numeric process ID.) If the Ith character of
Packit 709fb3
     this environment variable’s value is ‘1’, do not consider the Ith
Packit 709fb3
     operand of ‘grep’ to be an option, even if it appears to be one.  A
Packit 709fb3
     shell can put this variable in the environment for each command it
Packit 709fb3
     runs, specifying which operands are the results of file name
Packit 709fb3
     wildcard expansion and therefore should not be treated as options.
Packit 709fb3
     This behavior is available only with the GNU C library, and only
Packit 709fb3
     when ‘POSIXLY_CORRECT’ is not set.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Exit Status,  Next: grep Programs,  Prev: Environment Variables,  Up: Invoking
Packit 709fb3
Packit 709fb3
2.3 Exit Status
Packit 709fb3
===============
Packit 709fb3
Packit 709fb3
Normally the exit status is 0 if a line is selected, 1 if no lines were
Packit 709fb3
selected, and 2 if an error occurred.  However, if the ‘-q’ or ‘--quiet’
Packit 709fb3
or ‘--silent’ option is used and a line is selected, the exit status is
Packit 709fb3
0 even if an error occurred.  Other ‘grep’ implementations may exit with
Packit 709fb3
status greater than 2 on error.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: grep Programs,  Prev: Exit Status,  Up: Invoking
Packit 709fb3
Packit 709fb3
2.4 ‘grep’ Programs
Packit 709fb3
===================
Packit 709fb3
Packit 709fb3
‘grep’ searches the named input files for lines containing a match to
Packit 709fb3
the given pattern.  By default, ‘grep’ prints the matching lines.  A
Packit 709fb3
file named ‘-’ stands for standard input.  If no input is specified,
Packit 709fb3
‘grep’ searches the working directory ‘.’ if given a command-line option
Packit 709fb3
specifying recursion; otherwise, ‘grep’ searches standard input.  There
Packit 709fb3
are four major variants of ‘grep’, controlled by the following options.
Packit 709fb3
Packit 709fb3
‘-G’
Packit 709fb3
‘--basic-regexp’
Packit 709fb3
     Interpret the pattern as a basic regular expression (BRE). This is
Packit 709fb3
     the default.
Packit 709fb3
Packit 709fb3
‘-E’
Packit 709fb3
‘--extended-regexp’
Packit 709fb3
     Interpret the pattern as an extended regular expression (ERE).
Packit 709fb3
     (‘-E’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-F’
Packit 709fb3
‘--fixed-strings’
Packit 709fb3
     Interpret the pattern as a list of fixed strings (instead of
Packit 709fb3
     regular expressions), separated by newlines, any of which is to be
Packit 709fb3
     matched.  (‘-F’ is specified by POSIX.)
Packit 709fb3
Packit 709fb3
‘-P’
Packit 709fb3
‘--perl-regexp’
Packit 709fb3
     Interpret the pattern as a Perl-compatible regular expression
Packit 709fb3
     (PCRE). This is experimental, particularly when combined with the
Packit 709fb3
     ‘-z’ (‘--null-data’) option, and ‘grep -P’ may warn of
Packit 709fb3
     unimplemented features.  *Note Other Options::.
Packit 709fb3
Packit 709fb3
   In addition, two variant programs ‘egrep’ and ‘fgrep’ are available.
Packit 709fb3
‘egrep’ is the same as ‘grep -E’.  ‘fgrep’ is the same as ‘grep -F’.
Packit 709fb3
Direct invocation as either ‘egrep’ or ‘fgrep’ is deprecated, but is
Packit 709fb3
provided to allow historical applications that rely on them to run
Packit 709fb3
unmodified.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Regular Expressions,  Next: Usage,  Prev: Invoking,  Up: Top
Packit 709fb3
Packit 709fb3
3 Regular Expressions
Packit 709fb3
*********************
Packit 709fb3
Packit 709fb3
A “regular expression” is a pattern that describes a set of strings.
Packit 709fb3
Regular expressions are constructed analogously to arithmetic
Packit 709fb3
expressions, by using various operators to combine smaller expressions.
Packit 709fb3
‘grep’ understands three different versions of regular expression
Packit 709fb3
syntax: basic (BRE), extended (ERE), and Perl-compatible (PCRE). In GNU
Packit 709fb3
‘grep’, there is no difference in available functionality between the
Packit 709fb3
basic and extended syntaxes.  In other implementations, basic regular
Packit 709fb3
expressions are less powerful.  The following description applies to
Packit 709fb3
extended regular expressions; differences for basic regular expressions
Packit 709fb3
are summarized afterwards.  Perl-compatible regular expressions give
Packit 709fb3
additional functionality, and are documented in the pcresyntax(3) and
Packit 709fb3
pcrepattern(3) manual pages, but work only if PCRE is available in the
Packit 709fb3
system.
Packit 709fb3
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* Fundamental Structure::
Packit 709fb3
* Character Classes and Bracket Expressions::
Packit 709fb3
* The Backslash Character and Special Expressions::
Packit 709fb3
* Anchoring::
Packit 709fb3
* Back-references and Subexpressions::
Packit 709fb3
* Basic vs Extended::
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Fundamental Structure,  Next: Character Classes and Bracket Expressions,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.1 Fundamental Structure
Packit 709fb3
=========================
Packit 709fb3
Packit 709fb3
The fundamental building blocks are the regular expressions that match a
Packit 709fb3
single character.  Most characters, including all letters and digits,
Packit 709fb3
are regular expressions that match themselves.  Any meta-character with
Packit 709fb3
special meaning may be quoted by preceding it with a backslash.
Packit 709fb3
Packit 709fb3
   A regular expression may be followed by one of several repetition
Packit 709fb3
operators:
Packit 709fb3
Packit 709fb3
‘.’
Packit 709fb3
     The period ‘.’ matches any single character.
Packit 709fb3
Packit 709fb3
‘?’
Packit 709fb3
     The preceding item is optional and will be matched at most once.
Packit 709fb3
Packit 709fb3
‘*’
Packit 709fb3
     The preceding item will be matched zero or more times.
Packit 709fb3
Packit 709fb3
‘+’
Packit 709fb3
     The preceding item will be matched one or more times.
Packit 709fb3
Packit 709fb3
‘{N}’
Packit 709fb3
     The preceding item is matched exactly N times.
Packit 709fb3
Packit 709fb3
‘{N,}’
Packit 709fb3
     The preceding item is matched N or more times.
Packit 709fb3
Packit 709fb3
‘{,M}’
Packit 709fb3
     The preceding item is matched at most M times.  This is a GNU
Packit 709fb3
     extension.
Packit 709fb3
Packit 709fb3
‘{N,M}’
Packit 709fb3
     The preceding item is matched at least N times, but not more than M
Packit 709fb3
     times.
Packit 709fb3
Packit 709fb3
   The empty regular expression matches the empty string.  Two regular
Packit 709fb3
expressions may be concatenated; the resulting regular expression
Packit 709fb3
matches any string formed by concatenating two substrings that
Packit 709fb3
respectively match the concatenated expressions.
Packit 709fb3
Packit 709fb3
   Two regular expressions may be joined by the infix operator ‘|’; the
Packit 709fb3
resulting regular expression matches any string matching either
Packit 709fb3
alternate expression.
Packit 709fb3
Packit 709fb3
   Repetition takes precedence over concatenation, which in turn takes
Packit 709fb3
precedence over alternation.  A whole expression may be enclosed in
Packit 709fb3
parentheses to override these precedence rules and form a subexpression.
Packit 709fb3
An unmatched ‘)’ matches just itself.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Character Classes and Bracket Expressions,  Next: The Backslash Character and Special Expressions,  Prev: Fundamental Structure,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.2 Character Classes and Bracket Expressions
Packit 709fb3
=============================================
Packit 709fb3
Packit 709fb3
A “bracket expression” is a list of characters enclosed by ‘[’ and ‘]’.
Packit 709fb3
It matches any single character in that list; if the first character of
Packit 709fb3
the list is the caret ‘^’, then it matches any character *not* in the
Packit 709fb3
list.  For example, the regular expression ‘[0123456789]’ matches any
Packit 709fb3
single digit.
Packit 709fb3
Packit 709fb3
   Within a bracket expression, a “range expression” consists of two
Packit 709fb3
characters separated by a hyphen.  It matches any single character that
Packit 709fb3
sorts between the two characters, inclusive.  In the default C locale,
Packit 709fb3
the sorting sequence is the native character order; for example, ‘[a-d]’
Packit 709fb3
is equivalent to ‘[abcd]’.  In other locales, the sorting sequence is
Packit 709fb3
not specified, and ‘[a-d]’ might be equivalent to ‘[abcd]’ or to
Packit 709fb3
‘[aBbCcDd]’, or it might fail to match any character, or the set of
Packit 709fb3
characters that it matches might even be erratic.  To obtain the
Packit 709fb3
traditional interpretation of bracket expressions, you can use the ‘C’
Packit 709fb3
locale by setting the ‘LC_ALL’ environment variable to the value ‘C’.
Packit 709fb3
Packit 709fb3
   Finally, certain named classes of characters are predefined within
Packit 709fb3
bracket expressions, as follows.  Their interpretation depends on the
Packit 709fb3
‘LC_CTYPE’ locale; for example, ‘[[:alnum:]]’ means the character class
Packit 709fb3
of numbers and letters in the current locale.
Packit 709fb3
Packit 709fb3
‘[:alnum:]’
Packit 709fb3
     Alphanumeric characters: ‘[:alpha:]’ and ‘[:digit:]’; in the ‘C’
Packit 709fb3
     locale and ASCII character encoding, this is the same as
Packit 709fb3
     ‘[0-9A-Za-z]’.
Packit 709fb3
Packit 709fb3
‘[:alpha:]’
Packit 709fb3
     Alphabetic characters: ‘[:lower:]’ and ‘[:upper:]’; in the ‘C’
Packit 709fb3
     locale and ASCII character encoding, this is the same as
Packit 709fb3
     ‘[A-Za-z]’.
Packit 709fb3
Packit 709fb3
‘[:blank:]’
Packit 709fb3
     Blank characters: space and tab.
Packit 709fb3
Packit 709fb3
‘[:cntrl:]’
Packit 709fb3
     Control characters.  In ASCII, these characters have octal codes
Packit 709fb3
     000 through 037, and 177 (DEL). In other character sets, these are
Packit 709fb3
     the equivalent characters, if any.
Packit 709fb3
Packit 709fb3
‘[:digit:]’
Packit 709fb3
     Digits: ‘0 1 2 3 4 5 6 7 8 9’.
Packit 709fb3
Packit 709fb3
‘[:graph:]’
Packit 709fb3
     Graphical characters: ‘[:alnum:]’ and ‘[:punct:]’.
Packit 709fb3
Packit 709fb3
‘[:lower:]’
Packit 709fb3
     Lower-case letters; in the ‘C’ locale and ASCII character encoding,
Packit 709fb3
     this is ‘a b c d e f g h i j k l m n o p q r s t u v w x y z’.
Packit 709fb3
Packit 709fb3
‘[:print:]’
Packit 709fb3
     Printable characters: ‘[:alnum:]’, ‘[:punct:]’, and space.
Packit 709fb3
Packit 709fb3
‘[:punct:]’
Packit 709fb3
     Punctuation characters; in the ‘C’ locale and ASCII character
Packit 709fb3
     encoding, this is ‘! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \
Packit 709fb3
     ] ^ _ ` { | } ~’.
Packit 709fb3
Packit 709fb3
‘[:space:]’
Packit 709fb3
     Space characters: in the ‘C’ locale, this is tab, newline, vertical
Packit 709fb3
     tab, form feed, carriage return, and space.  *Note Usage::, for
Packit 709fb3
     more discussion of matching newlines.
Packit 709fb3
Packit 709fb3
‘[:upper:]’
Packit 709fb3
     Upper-case letters: in the ‘C’ locale and ASCII character encoding,
Packit 709fb3
     this is ‘A B C D E F G H I J K L M N O P Q R S T U V W X Y Z’.
Packit 709fb3
Packit 709fb3
‘[:xdigit:]’
Packit 709fb3
     Hexadecimal digits: ‘0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f’.
Packit 709fb3
Packit 709fb3
   Note that the brackets in these class names are part of the symbolic
Packit 709fb3
names, and must be included in addition to the brackets delimiting the
Packit 709fb3
bracket expression.
Packit 709fb3
Packit 709fb3
   If you mistakenly omit the outer brackets, and search for say,
Packit 709fb3
‘[:upper:]’, GNU ‘grep’ prints a diagnostic and exits with status 2, on
Packit 709fb3
the assumption that you did not intend to search for the nominally
Packit 709fb3
equivalent regular expression: ‘[:epru]’.  Set the ‘POSIXLY_CORRECT’
Packit 709fb3
environment variable to disable this feature.
Packit 709fb3
Packit 709fb3
   Most meta-characters lose their special meaning inside bracket
Packit 709fb3
expressions.
Packit 709fb3
Packit 709fb3
‘]’
Packit 709fb3
     ends the bracket expression if it’s not the first list item.  So,
Packit 709fb3
     if you want to make the ‘]’ character a list item, you must put it
Packit 709fb3
     first.
Packit 709fb3
Packit 709fb3
‘[.’
Packit 709fb3
     represents the open collating symbol.
Packit 709fb3
Packit 709fb3
‘.]’
Packit 709fb3
     represents the close collating symbol.
Packit 709fb3
Packit 709fb3
‘[=’
Packit 709fb3
     represents the open equivalence class.
Packit 709fb3
Packit 709fb3
‘=]’
Packit 709fb3
     represents the close equivalence class.
Packit 709fb3
Packit 709fb3
‘[:’
Packit 709fb3
     represents the open character class symbol, and should be followed
Packit 709fb3
     by a valid character class name.
Packit 709fb3
Packit 709fb3
‘:]’
Packit 709fb3
     represents the close character class symbol.
Packit 709fb3
Packit 709fb3
‘-’
Packit 709fb3
     represents the range if it’s not first or last in a list or the
Packit 709fb3
     ending point of a range.
Packit 709fb3
Packit 709fb3
‘^’
Packit 709fb3
     represents the characters not in the list.  If you want to make the
Packit 709fb3
     ‘^’ character a list item, place it anywhere but first.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: The Backslash Character and Special Expressions,  Next: Anchoring,  Prev: Character Classes and Bracket Expressions,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.3 The Backslash Character and Special Expressions
Packit 709fb3
===================================================
Packit 709fb3
Packit 709fb3
The ‘\’ character, when followed by certain ordinary characters, takes a
Packit 709fb3
special meaning:
Packit 709fb3
Packit 709fb3
‘\b’
Packit 709fb3
     Match the empty string at the edge of a word.
Packit 709fb3
Packit 709fb3
‘\B’
Packit 709fb3
     Match the empty string provided it’s not at the edge of a word.
Packit 709fb3
Packit 709fb3
‘\<’
Packit 709fb3
     Match the empty string at the beginning of word.
Packit 709fb3
Packit 709fb3
‘\>’
Packit 709fb3
     Match the empty string at the end of word.
Packit 709fb3
Packit 709fb3
‘\w’
Packit 709fb3
     Match word constituent, it is a synonym for ‘[_[:alnum:]]’.
Packit 709fb3
Packit 709fb3
‘\W’
Packit 709fb3
     Match non-word constituent, it is a synonym for ‘[^_[:alnum:]]’.
Packit 709fb3
Packit 709fb3
‘\s’
Packit 709fb3
     Match whitespace, it is a synonym for ‘[[:space:]]’.
Packit 709fb3
Packit 709fb3
‘\S’
Packit 709fb3
     Match non-whitespace, it is a synonym for ‘[^[:space:]]’.
Packit 709fb3
Packit 709fb3
   For example, ‘\brat\b’ matches the separate word ‘rat’, ‘\Brat\B’
Packit 709fb3
matches ‘crate’ but not ‘furry rat’.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Anchoring,  Next: Back-references and Subexpressions,  Prev: The Backslash Character and Special Expressions,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.4 Anchoring
Packit 709fb3
=============
Packit 709fb3
Packit 709fb3
The caret ‘^’ and the dollar sign ‘$’ are meta-characters that
Packit 709fb3
respectively match the empty string at the beginning and end of a line.
Packit 709fb3
They are termed “anchors”, since they force the match to be “anchored”
Packit 709fb3
to beginning or end of a line, respectively.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Back-references and Subexpressions,  Next: Basic vs Extended,  Prev: Anchoring,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.5 Back-references and Subexpressions
Packit 709fb3
======================================
Packit 709fb3
Packit 709fb3
The back-reference ‘\N’, where N is a single digit, matches the
Packit 709fb3
substring previously matched by the Nth parenthesized subexpression of
Packit 709fb3
the regular expression.  For example, ‘(a)\1’ matches ‘aa’.  When used
Packit 709fb3
with alternation, if the group does not participate in the match then
Packit 709fb3
the back-reference makes the whole match fail.  For example, ‘a(.)|b\1’
Packit 709fb3
will not match ‘ba’.  When multiple regular expressions are given with
Packit 709fb3
‘-e’ or from a file (‘-f FILE’), back-references are local to each
Packit 709fb3
expression.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Basic vs Extended,  Prev: Back-references and Subexpressions,  Up: Regular Expressions
Packit 709fb3
Packit 709fb3
3.6 Basic vs Extended Regular Expressions
Packit 709fb3
=========================================
Packit 709fb3
Packit 709fb3
In basic regular expressions the meta-characters ‘?’, ‘+’, ‘{’, ‘|’,
Packit 709fb3
‘(’, and ‘)’ lose their special meaning; instead use the backslashed
Packit 709fb3
versions ‘\?’, ‘\+’, ‘\{’, ‘\|’, ‘\(’, and ‘\)’.
Packit 709fb3
Packit 709fb3
   Traditional ‘egrep’ did not support the ‘{’ meta-character, and some
Packit 709fb3
‘egrep’ implementations support ‘\{’ instead, so portable scripts should
Packit 709fb3
avoid ‘{’ in ‘grep -E’ patterns and should use ‘[{]’ to match a literal
Packit 709fb3
‘{’.
Packit 709fb3
Packit 709fb3
   GNU ‘grep -E’ attempts to support traditional usage by assuming that
Packit 709fb3
‘{’ is not special if it would be the start of an invalid interval
Packit 709fb3
specification.  For example, the command ‘grep -E '{1'’ searches for the
Packit 709fb3
two-character string ‘{1’ instead of reporting a syntax error in the
Packit 709fb3
regular expression.  POSIX allows this behavior as an extension, but
Packit 709fb3
portable scripts should avoid it.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Usage,  Next: Performance,  Prev: Regular Expressions,  Up: Top
Packit 709fb3
Packit 709fb3
4 Usage
Packit 709fb3
*******
Packit 709fb3
Packit 709fb3
Here is an example command that invokes GNU ‘grep’:
Packit 709fb3
Packit 709fb3
     grep -i 'hello.*world' menu.h main.c
Packit 709fb3
Packit 709fb3
This lists all lines in the files ‘menu.h’ and ‘main.c’ that contain the
Packit 709fb3
string ‘hello’ followed by the string ‘world’; this is because ‘.*’
Packit 709fb3
matches zero or more characters within a line.  *Note Regular
Packit 709fb3
Expressions::.  The ‘-i’ option causes ‘grep’ to ignore case, causing it
Packit 709fb3
to match the line ‘Hello, world!’, which it would not otherwise match.
Packit 709fb3
*Note Invoking::, for more details about how to invoke ‘grep’.
Packit 709fb3
Packit 709fb3
   Here are some common questions and answers about ‘grep’ usage.
Packit 709fb3
Packit 709fb3
  1. How can I list just the names of matching files?
Packit 709fb3
Packit 709fb3
          grep -l 'main' *.c
Packit 709fb3
Packit 709fb3
     lists the names of all C files in the current directory whose
Packit 709fb3
     contents mention ‘main’.
Packit 709fb3
Packit 709fb3
  2. How do I search directories recursively?
Packit 709fb3
Packit 709fb3
          grep -r 'hello' /home/gigi
Packit 709fb3
Packit 709fb3
     searches for ‘hello’ in all files under the ‘/home/gigi’ directory.
Packit 709fb3
     For more control over which files are searched, use ‘find’, ‘grep’,
Packit 709fb3
     and ‘xargs’.  For example, the following command searches only C
Packit 709fb3
     files:
Packit 709fb3
Packit 709fb3
          find /home/gigi -name '*.c' -print0 | xargs -0r grep -H 'hello'
Packit 709fb3
Packit 709fb3
     This differs from the command:
Packit 709fb3
Packit 709fb3
          grep -H 'hello' *.c
Packit 709fb3
Packit 709fb3
     which merely looks for ‘hello’ in all files in the current
Packit 709fb3
     directory whose names end in ‘.c’.  The ‘find ...’ command line
Packit 709fb3
     above is more similar to the command:
Packit 709fb3
Packit 709fb3
          grep -rH --include='*.c' 'hello' /home/gigi
Packit 709fb3
Packit 709fb3
  3. What if a pattern has a leading ‘-’?
Packit 709fb3
Packit 709fb3
          grep -e '--cut here--' *
Packit 709fb3
Packit 709fb3
     searches for all lines matching ‘--cut here--’.  Without ‘-e’,
Packit 709fb3
     ‘grep’ would attempt to parse ‘--cut here--’ as a list of options.
Packit 709fb3
Packit 709fb3
  4. Suppose I want to search for a whole word, not a part of a word?
Packit 709fb3
Packit 709fb3
          grep -w 'hello' *
Packit 709fb3
Packit 709fb3
     searches only for instances of ‘hello’ that are entire words; it
Packit 709fb3
     does not match ‘Othello’.  For more control, use ‘\<’ and ‘\>’ to
Packit 709fb3
     match the start and end of words.  For example:
Packit 709fb3
Packit 709fb3
          grep 'hello\>' *
Packit 709fb3
Packit 709fb3
     searches only for words ending in ‘hello’, so it matches the word
Packit 709fb3
     ‘Othello’.
Packit 709fb3
Packit 709fb3
  5. How do I output context around the matching lines?
Packit 709fb3
Packit 709fb3
          grep -C 2 'hello' *
Packit 709fb3
Packit 709fb3
     prints two lines of context around each matching line.
Packit 709fb3
Packit 709fb3
  6. How do I force ‘grep’ to print the name of the file?
Packit 709fb3
Packit 709fb3
     Append ‘/dev/null’:
Packit 709fb3
Packit 709fb3
          grep 'eli' /etc/passwd /dev/null
Packit 709fb3
Packit 709fb3
     gets you:
Packit 709fb3
Packit 709fb3
          /etc/passwd:eli:x:2098:1000:Eli Smith:/home/eli:/bin/bash
Packit 709fb3
Packit 709fb3
     Alternatively, use ‘-H’, which is a GNU extension:
Packit 709fb3
Packit 709fb3
          grep -H 'eli' /etc/passwd
Packit 709fb3
Packit 709fb3
  7. Why do people use strange regular expressions on ‘ps’ output?
Packit 709fb3
Packit 709fb3
          ps -ef | grep '[c]ron'
Packit 709fb3
Packit 709fb3
     If the pattern had been written without the square brackets, it
Packit 709fb3
     would have matched not only the ‘ps’ output line for ‘cron’, but
Packit 709fb3
     also the ‘ps’ output line for ‘grep’.  Note that on some platforms,
Packit 709fb3
     ‘ps’ limits the output to the width of the screen; ‘grep’ does not
Packit 709fb3
     have any limit on the length of a line except the available memory.
Packit 709fb3
Packit 709fb3
  8. Why does ‘grep’ report “Binary file matches”?
Packit 709fb3
Packit 709fb3
     If ‘grep’ listed all matching “lines” from a binary file, it would
Packit 709fb3
     probably generate output that is not useful, and it might even muck
Packit 709fb3
     up your display.  So GNU ‘grep’ suppresses output from files that
Packit 709fb3
     appear to be binary files.  To force GNU ‘grep’ to output lines
Packit 709fb3
     even from files that appear to be binary, use the ‘-a’ or
Packit 709fb3
     ‘--binary-files=text’ option.  To eliminate the “Binary file
Packit 709fb3
     matches” messages, use the ‘-I’ or ‘--binary-files=without-match’
Packit 709fb3
     option.
Packit 709fb3
Packit 709fb3
  9. Why doesn’t ‘grep -lv’ print non-matching file names?
Packit 709fb3
Packit 709fb3
     ‘grep -lv’ lists the names of all files containing one or more
Packit 709fb3
     lines that do not match.  To list the names of all files that
Packit 709fb3
     contain no matching lines, use the ‘-L’ or ‘--files-without-match’
Packit 709fb3
     option.
Packit 709fb3
Packit 709fb3
  10. I can do “OR” with ‘|’, but what about “AND”?
Packit 709fb3
Packit 709fb3
          grep 'paul' /etc/motd | grep 'franc,ois'
Packit 709fb3
Packit 709fb3
     finds all lines that contain both ‘paul’ and ‘franc,ois’.
Packit 709fb3
Packit 709fb3
  11. Why does the empty pattern match every input line?
Packit 709fb3
Packit 709fb3
     The ‘grep’ command searches for lines that contain strings that
Packit 709fb3
     match a pattern.  Every line contains the empty string, so an empty
Packit 709fb3
     pattern causes ‘grep’ to find a match on each line.  It is not the
Packit 709fb3
     only such pattern: ‘^’, ‘$’, ‘.*’, and many other patterns cause
Packit 709fb3
     ‘grep’ to match every line.
Packit 709fb3
Packit 709fb3
     To match empty lines, use the pattern ‘^$’.  To match blank lines,
Packit 709fb3
     use the pattern ‘^[[:blank:]]*$’.  To match no lines at all, use
Packit 709fb3
     the command ‘grep -f /dev/null’.
Packit 709fb3
Packit 709fb3
  12. How can I search in both standard input and in files?
Packit 709fb3
Packit 709fb3
     Use the special file name ‘-’:
Packit 709fb3
Packit 709fb3
          cat /etc/passwd | grep 'alain' - /etc/motd
Packit 709fb3
Packit 709fb3
  13. How to express palindromes in a regular expression?
Packit 709fb3
Packit 709fb3
     It can be done by using back-references; for example, a palindrome
Packit 709fb3
     of 4 characters can be written with a BRE:
Packit 709fb3
Packit 709fb3
          grep -w -e '\(.\)\(.\).\2\1' file
Packit 709fb3
Packit 709fb3
     It matches the word “radar” or “civic.”
Packit 709fb3
Packit 709fb3
     Guglielmo Bondioni proposed a single RE that finds all palindromes
Packit 709fb3
     up to 19 characters long using 9 subexpressions and
Packit 709fb3
     9 back-references:
Packit 709fb3
Packit 709fb3
          grep -E -e '^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$' file
Packit 709fb3
Packit 709fb3
     Note this is done by using GNU ERE extensions; it might not be
Packit 709fb3
     portable to other implementations of ‘grep’.
Packit 709fb3
Packit 709fb3
  14. Why is this back-reference failing?
Packit 709fb3
Packit 709fb3
          echo 'ba' | grep -E '(a)\1|b\1'
Packit 709fb3
Packit 709fb3
     This gives no output, because the first alternate ‘(a)\1’ does not
Packit 709fb3
     match, as there is no ‘aa’ in the input, so the ‘\1’ in the second
Packit 709fb3
     alternate has nothing to refer back to, meaning it will never match
Packit 709fb3
     anything.  (The second alternate in this example can only match if
Packit 709fb3
     the first alternate has matched—making the second one superfluous.)
Packit 709fb3
Packit 709fb3
  15. How can I match across lines?
Packit 709fb3
Packit 709fb3
     Standard grep cannot do this, as it is fundamentally line-based.
Packit 709fb3
     Therefore, merely using the ‘[:space:]’ character class does not
Packit 709fb3
     match newlines in the way you might expect.
Packit 709fb3
Packit 709fb3
     With the GNU ‘grep’ option ‘-z’ (‘--null-data’), each input and
Packit 709fb3
     output “line” is null-terminated; *note Other Options::.  Thus, you
Packit 709fb3
     can match newlines in the input, but typically if there is a match
Packit 709fb3
     the entire input is output, so this usage is often combined with
Packit 709fb3
     output-suppressing options like ‘-q’, e.g.:
Packit 709fb3
Packit 709fb3
          printf 'foo\nbar\n' | grep -z -q 'foo[[:space:]]\+bar'
Packit 709fb3
Packit 709fb3
     If this does not suffice, you can transform the input before giving
Packit 709fb3
     it to ‘grep’, or turn to ‘awk’, ‘sed’, ‘perl’, or many other
Packit 709fb3
     utilities that are designed to operate across lines.
Packit 709fb3
Packit 709fb3
  16. What do ‘grep’, ‘fgrep’, and ‘egrep’ stand for?
Packit 709fb3
Packit 709fb3
     The name ‘grep’ comes from the way line editing was done on Unix.
Packit 709fb3
     For example, ‘ed’ uses the following syntax to print a list of
Packit 709fb3
     matching lines on the screen:
Packit 709fb3
Packit 709fb3
          global/regular expression/print
Packit 709fb3
          g/re/p
Packit 709fb3
Packit 709fb3
     ‘fgrep’ stands for Fixed ‘grep’; ‘egrep’ stands for Extended
Packit 709fb3
     ‘grep’.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Performance,  Next: Reporting Bugs,  Prev: Usage,  Up: Top
Packit 709fb3
Packit 709fb3
5 Performance
Packit 709fb3
*************
Packit 709fb3
Packit 709fb3
Typically ‘grep’ is an efficient way to search text.  However, it can be
Packit 709fb3
quite slow in some cases, and it can search large files where even minor
Packit 709fb3
performance tweaking can help significantly.  Although the algorithm
Packit 709fb3
used by ‘grep’ is an implementation detail that can change from release
Packit 709fb3
to release, understanding its basic strengths and weaknesses can help
Packit 709fb3
you improve its performance.
Packit 709fb3
Packit 709fb3
   The ‘grep’ command operates partly via a set of automata that are
Packit 709fb3
designed for efficiency, and partly via a slower matcher that takes over
Packit 709fb3
when the fast matchers run into unusual features like back-references.
Packit 709fb3
When feasible, the Boyer–Moore fast string searching algorithm is used
Packit 709fb3
to match a single fixed pattern, and the Aho–Corasick algorithm is used
Packit 709fb3
to match multiple fixed patterns.
Packit 709fb3
Packit 709fb3
   Generally speaking ‘grep’ operates more efficiently in single-byte
Packit 709fb3
locales, since it can avoid the special processing needed for multi-byte
Packit 709fb3
characters.  If your pattern will work just as well that way, setting
Packit 709fb3
‘LC_ALL’ to a single-byte locale can help performance considerably.
Packit 709fb3
Setting ‘LC_ALL='C'’ can be particularly efficient, as ‘grep’ is tuned
Packit 709fb3
for that locale.
Packit 709fb3
Packit 709fb3
   Outside the ‘C’ locale, case-insensitive search, and search for
Packit 709fb3
bracket expressions like ‘[a-z]’ and ‘[[=a=]b]’, can be surprisingly
Packit 709fb3
inefficient due to difficulties in fast portable access to concepts like
Packit 709fb3
multi-character collating elements.
Packit 709fb3
Packit 709fb3
   A back-reference such as ‘\1’ can hurt performance significantly in
Packit 709fb3
some cases, since back-references cannot in general be implemented via a
Packit 709fb3
finite state automaton, and instead trigger a backtracking algorithm
Packit 709fb3
that can be quite inefficient.  For example, although the pattern
Packit 709fb3
‘^(.*)\1{14}(.*)\2{13}$’ matches only lines whose lengths can be written
Packit 709fb3
as a sum 15x + 14y for nonnegative integers x and y, the pattern matcher
Packit 709fb3
does not perform linear Diophantine analysis and instead backtracks
Packit 709fb3
through all possible matching strings, using an algorithm that is
Packit 709fb3
exponential in the worst case.
Packit 709fb3
Packit 709fb3
   On some operating systems that support files with holes—large regions
Packit 709fb3
of zeros that are not physically present on secondary storage—‘grep’ can
Packit 709fb3
skip over the holes efficiently without needing to read the zeros.  This
Packit 709fb3
optimization is not available if the ‘-a’ (‘--text’) option is used
Packit 709fb3
(*note File and Directory Selection::), unless the ‘-z’ (‘--null-data’)
Packit 709fb3
option is also used (*note Other Options::).
Packit 709fb3
Packit 709fb3
   For more about the algorithms used by ‘grep’ and about related string
Packit 709fb3
matching algorithms, see:
Packit 709fb3
Packit 709fb3
   • Aho AV. Algorithms for finding patterns in strings. In: van Leeuwen
Packit 709fb3
     J. _Handbook of Theoretical Computer Science_, vol. A. New York:
Packit 709fb3
     Elsevier; 1990. p. 255–300. This surveys classic string matching
Packit 709fb3
     algorithms, some of which are used by ‘grep’.
Packit 709fb3
Packit 709fb3
   • Aho AV, Corasick MJ. Efficient string matching: an aid to
Packit 709fb3
     bibliographic search. _CACM_. 1975;18(6):333–40.
Packit 709fb3
     <http://dx.doi.org/10.1145/360825.360855>. This introduces the
Packit 709fb3
     Aho–Corasick algorithm.
Packit 709fb3
Packit 709fb3
   • Boyer RS, Moore JS. A fast string searching algorithm. _CACM_.
Packit 709fb3
     1977;20(10):762–72. <http://dx.doi.org/10.1145/359842.359859>. This
Packit 709fb3
     introduces the Boyer–Moore algorithm.
Packit 709fb3
Packit 709fb3
   • Faro S, Lecroq T. The exact online string matching problem: a
Packit 709fb3
     review of the most recent results. _ACM Comput Surv_.
Packit 709fb3
     2013;45(2):13. <http://dx.doi.org/10.1145/2431211.2431212>. This
Packit 709fb3
     surveys string matching algorithms that might help improve the
Packit 709fb3
     performance of ‘grep’ in the future.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Reporting Bugs,  Next: Copying,  Prev: Performance,  Up: Top
Packit 709fb3
Packit 709fb3
6 Reporting bugs
Packit 709fb3
****************
Packit 709fb3
Packit 709fb3
Bug reports can be found at the GNU bug report logs for ‘grep’
Packit 709fb3
(http://debbugs.gnu.org/cgi/pkgreport.cgi?package=grep).  If you find a
Packit 709fb3
bug not listed there, please email it to <bug-grep@gnu.org> to create a
Packit 709fb3
new bug report.
Packit 709fb3
Packit 709fb3
6.1 Known Bugs
Packit 709fb3
==============
Packit 709fb3
Packit 709fb3
Large repetition counts in the ‘{n,m}’ construct may cause ‘grep’ to use
Packit 709fb3
lots of memory.  In addition, certain other obscure regular expressions
Packit 709fb3
require exponential time and space, and may cause ‘grep’ to run out of
Packit 709fb3
memory.
Packit 709fb3
Packit 709fb3
   Back-references are very slow, and may require exponential time.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Copying,  Next: Index,  Prev: Reporting Bugs,  Up: Top
Packit 709fb3
Packit 709fb3
7 Copying
Packit 709fb3
*********
Packit 709fb3
Packit 709fb3
GNU ‘grep’ is licensed under the GNU GPL, which makes it “free
Packit 709fb3
software”.
Packit 709fb3
Packit 709fb3
   The “free” in “free software” refers to liberty, not price.  As some
Packit 709fb3
GNU project advocates like to point out, think of “free speech” rather
Packit 709fb3
than “free beer”.  In short, you have the right (freedom) to run and
Packit 709fb3
change ‘grep’ and distribute it to other people, and—if you want—charge
Packit 709fb3
money for doing either.  The important restriction is that you have to
Packit 709fb3
grant your recipients the same rights and impose the same restrictions.
Packit 709fb3
Packit 709fb3
   This general method of licensing software is sometimes called “open
Packit 709fb3
source”.  The GNU project prefers the term “free software” for reasons
Packit 709fb3
outlined at
Packit 709fb3
<http://www.gnu.org/philosophy/open-source-misses-the-point.html>.
Packit 709fb3
Packit 709fb3
   This manual is free documentation in the same sense.  The
Packit 709fb3
documentation license is included below.  The license for the program is
Packit 709fb3
available with the source code, or at
Packit 709fb3
<http://www.gnu.org/licenses/gpl.html>.
Packit 709fb3
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* GNU Free Documentation License::
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: GNU Free Documentation License,  Up: Copying
Packit 709fb3
Packit 709fb3
7.1 GNU Free Documentation License
Packit 709fb3
==================================
Packit 709fb3
Packit 709fb3
                     Version 1.3, 3 November 2008
Packit 709fb3
Packit 709fb3
     Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Packit 709fb3
     <http://fsf.org/>
Packit 709fb3
Packit 709fb3
     Everyone is permitted to copy and distribute verbatim copies
Packit 709fb3
     of this license document, but changing it is not allowed.
Packit 709fb3
Packit 709fb3
  0. PREAMBLE
Packit 709fb3
Packit 709fb3
     The purpose of this License is to make a manual, textbook, or other
Packit 709fb3
     functional and useful document “free” in the sense of freedom: to
Packit 709fb3
     assure everyone the effective freedom to copy and redistribute it,
Packit 709fb3
     with or without modifying it, either commercially or
Packit 709fb3
     noncommercially.  Secondarily, this License preserves for the
Packit 709fb3
     author and publisher a way to get credit for their work, while not
Packit 709fb3
     being considered responsible for modifications made by others.
Packit 709fb3
Packit 709fb3
     This License is a kind of “copyleft”, which means that derivative
Packit 709fb3
     works of the document must themselves be free in the same sense.
Packit 709fb3
     It complements the GNU General Public License, which is a copyleft
Packit 709fb3
     license designed for free software.
Packit 709fb3
Packit 709fb3
     We have designed this License in order to use it for manuals for
Packit 709fb3
     free software, because free software needs free documentation: a
Packit 709fb3
     free program should come with manuals providing the same freedoms
Packit 709fb3
     that the software does.  But this License is not limited to
Packit 709fb3
     software manuals; it can be used for any textual work, regardless
Packit 709fb3
     of subject matter or whether it is published as a printed book.  We
Packit 709fb3
     recommend this License principally for works whose purpose is
Packit 709fb3
     instruction or reference.
Packit 709fb3
Packit 709fb3
  1. APPLICABILITY AND DEFINITIONS
Packit 709fb3
Packit 709fb3
     This License applies to any manual or other work, in any medium,
Packit 709fb3
     that contains a notice placed by the copyright holder saying it can
Packit 709fb3
     be distributed under the terms of this License.  Such a notice
Packit 709fb3
     grants a world-wide, royalty-free license, unlimited in duration,
Packit 709fb3
     to use that work under the conditions stated herein.  The
Packit 709fb3
     “Document”, below, refers to any such manual or work.  Any member
Packit 709fb3
     of the public is a licensee, and is addressed as “you”.  You accept
Packit 709fb3
     the license if you copy, modify or distribute the work in a way
Packit 709fb3
     requiring permission under copyright law.
Packit 709fb3
Packit 709fb3
     A “Modified Version” of the Document means any work containing the
Packit 709fb3
     Document or a portion of it, either copied verbatim, or with
Packit 709fb3
     modifications and/or translated into another language.
Packit 709fb3
Packit 709fb3
     A “Secondary Section” is a named appendix or a front-matter section
Packit 709fb3
     of the Document that deals exclusively with the relationship of the
Packit 709fb3
     publishers or authors of the Document to the Document’s overall
Packit 709fb3
     subject (or to related matters) and contains nothing that could
Packit 709fb3
     fall directly within that overall subject.  (Thus, if the Document
Packit 709fb3
     is in part a textbook of mathematics, a Secondary Section may not
Packit 709fb3
     explain any mathematics.)  The relationship could be a matter of
Packit 709fb3
     historical connection with the subject or with related matters, or
Packit 709fb3
     of legal, commercial, philosophical, ethical or political position
Packit 709fb3
     regarding them.
Packit 709fb3
Packit 709fb3
     The “Invariant Sections” are certain Secondary Sections whose
Packit 709fb3
     titles are designated, as being those of Invariant Sections, in the
Packit 709fb3
     notice that says that the Document is released under this License.
Packit 709fb3
     If a section does not fit the above definition of Secondary then it
Packit 709fb3
     is not allowed to be designated as Invariant.  The Document may
Packit 709fb3
     contain zero Invariant Sections.  If the Document does not identify
Packit 709fb3
     any Invariant Sections then there are none.
Packit 709fb3
Packit 709fb3
     The “Cover Texts” are certain short passages of text that are
Packit 709fb3
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
Packit 709fb3
     that says that the Document is released under this License.  A
Packit 709fb3
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
Packit 709fb3
     be at most 25 words.
Packit 709fb3
Packit 709fb3
     A “Transparent” copy of the Document means a machine-readable copy,
Packit 709fb3
     represented in a format whose specification is available to the
Packit 709fb3
     general public, that is suitable for revising the document
Packit 709fb3
     straightforwardly with generic text editors or (for images composed
Packit 709fb3
     of pixels) generic paint programs or (for drawings) some widely
Packit 709fb3
     available drawing editor, and that is suitable for input to text
Packit 709fb3
     formatters or for automatic translation to a variety of formats
Packit 709fb3
     suitable for input to text formatters.  A copy made in an otherwise
Packit 709fb3
     Transparent file format whose markup, or absence of markup, has
Packit 709fb3
     been arranged to thwart or discourage subsequent modification by
Packit 709fb3
     readers is not Transparent.  An image format is not Transparent if
Packit 709fb3
     used for any substantial amount of text.  A copy that is not
Packit 709fb3
     “Transparent” is called “Opaque”.
Packit 709fb3
Packit 709fb3
     Examples of suitable formats for Transparent copies include plain
Packit 709fb3
     ASCII without markup, Texinfo input format, LaTeX input format,
Packit 709fb3
     SGML or XML using a publicly available DTD, and standard-conforming
Packit 709fb3
     simple HTML, PostScript or PDF designed for human modification.
Packit 709fb3
     Examples of transparent image formats include PNG, XCF and JPG.
Packit 709fb3
     Opaque formats include proprietary formats that can be read and
Packit 709fb3
     edited only by proprietary word processors, SGML or XML for which
Packit 709fb3
     the DTD and/or processing tools are not generally available, and
Packit 709fb3
     the machine-generated HTML, PostScript or PDF produced by some word
Packit 709fb3
     processors for output purposes only.
Packit 709fb3
Packit 709fb3
     The “Title Page” means, for a printed book, the title page itself,
Packit 709fb3
     plus such following pages as are needed to hold, legibly, the
Packit 709fb3
     material this License requires to appear in the title page.  For
Packit 709fb3
     works in formats which do not have any title page as such, “Title
Packit 709fb3
     Page” means the text near the most prominent appearance of the
Packit 709fb3
     work’s title, preceding the beginning of the body of the text.
Packit 709fb3
Packit 709fb3
     The “publisher” means any person or entity that distributes copies
Packit 709fb3
     of the Document to the public.
Packit 709fb3
Packit 709fb3
     A section “Entitled XYZ” means a named subunit of the Document
Packit 709fb3
     whose title either is precisely XYZ or contains XYZ in parentheses
Packit 709fb3
     following text that translates XYZ in another language.  (Here XYZ
Packit 709fb3
     stands for a specific section name mentioned below, such as
Packit 709fb3
     “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.)
Packit 709fb3
     To “Preserve the Title” of such a section when you modify the
Packit 709fb3
     Document means that it remains a section “Entitled XYZ” according
Packit 709fb3
     to this definition.
Packit 709fb3
Packit 709fb3
     The Document may include Warranty Disclaimers next to the notice
Packit 709fb3
     which states that this License applies to the Document.  These
Packit 709fb3
     Warranty Disclaimers are considered to be included by reference in
Packit 709fb3
     this License, but only as regards disclaiming warranties: any other
Packit 709fb3
     implication that these Warranty Disclaimers may have is void and
Packit 709fb3
     has no effect on the meaning of this License.
Packit 709fb3
Packit 709fb3
  2. VERBATIM COPYING
Packit 709fb3
Packit 709fb3
     You may copy and distribute the Document in any medium, either
Packit 709fb3
     commercially or noncommercially, provided that this License, the
Packit 709fb3
     copyright notices, and the license notice saying this License
Packit 709fb3
     applies to the Document are reproduced in all copies, and that you
Packit 709fb3
     add no other conditions whatsoever to those of this License.  You
Packit 709fb3
     may not use technical measures to obstruct or control the reading
Packit 709fb3
     or further copying of the copies you make or distribute.  However,
Packit 709fb3
     you may accept compensation in exchange for copies.  If you
Packit 709fb3
     distribute a large enough number of copies you must also follow the
Packit 709fb3
     conditions in section 3.
Packit 709fb3
Packit 709fb3
     You may also lend copies, under the same conditions stated above,
Packit 709fb3
     and you may publicly display copies.
Packit 709fb3
Packit 709fb3
  3. COPYING IN QUANTITY
Packit 709fb3
Packit 709fb3
     If you publish printed copies (or copies in media that commonly
Packit 709fb3
     have printed covers) of the Document, numbering more than 100, and
Packit 709fb3
     the Document’s license notice requires Cover Texts, you must
Packit 709fb3
     enclose the copies in covers that carry, clearly and legibly, all
Packit 709fb3
     these Cover Texts: Front-Cover Texts on the front cover, and
Packit 709fb3
     Back-Cover Texts on the back cover.  Both covers must also clearly
Packit 709fb3
     and legibly identify you as the publisher of these copies.  The
Packit 709fb3
     front cover must present the full title with all words of the title
Packit 709fb3
     equally prominent and visible.  You may add other material on the
Packit 709fb3
     covers in addition.  Copying with changes limited to the covers, as
Packit 709fb3
     long as they preserve the title of the Document and satisfy these
Packit 709fb3
     conditions, can be treated as verbatim copying in other respects.
Packit 709fb3
Packit 709fb3
     If the required texts for either cover are too voluminous to fit
Packit 709fb3
     legibly, you should put the first ones listed (as many as fit
Packit 709fb3
     reasonably) on the actual cover, and continue the rest onto
Packit 709fb3
     adjacent pages.
Packit 709fb3
Packit 709fb3
     If you publish or distribute Opaque copies of the Document
Packit 709fb3
     numbering more than 100, you must either include a machine-readable
Packit 709fb3
     Transparent copy along with each Opaque copy, or state in or with
Packit 709fb3
     each Opaque copy a computer-network location from which the general
Packit 709fb3
     network-using public has access to download using public-standard
Packit 709fb3
     network protocols a complete Transparent copy of the Document, free
Packit 709fb3
     of added material.  If you use the latter option, you must take
Packit 709fb3
     reasonably prudent steps, when you begin distribution of Opaque
Packit 709fb3
     copies in quantity, to ensure that this Transparent copy will
Packit 709fb3
     remain thus accessible at the stated location until at least one
Packit 709fb3
     year after the last time you distribute an Opaque copy (directly or
Packit 709fb3
     through your agents or retailers) of that edition to the public.
Packit 709fb3
Packit 709fb3
     It is requested, but not required, that you contact the authors of
Packit 709fb3
     the Document well before redistributing any large number of copies,
Packit 709fb3
     to give them a chance to provide you with an updated version of the
Packit 709fb3
     Document.
Packit 709fb3
Packit 709fb3
  4. MODIFICATIONS
Packit 709fb3
Packit 709fb3
     You may copy and distribute a Modified Version of the Document
Packit 709fb3
     under the conditions of sections 2 and 3 above, provided that you
Packit 709fb3
     release the Modified Version under precisely this License, with the
Packit 709fb3
     Modified Version filling the role of the Document, thus licensing
Packit 709fb3
     distribution and modification of the Modified Version to whoever
Packit 709fb3
     possesses a copy of it.  In addition, you must do these things in
Packit 709fb3
     the Modified Version:
Packit 709fb3
Packit 709fb3
       A. Use in the Title Page (and on the covers, if any) a title
Packit 709fb3
          distinct from that of the Document, and from those of previous
Packit 709fb3
          versions (which should, if there were any, be listed in the
Packit 709fb3
          History section of the Document).  You may use the same title
Packit 709fb3
          as a previous version if the original publisher of that
Packit 709fb3
          version gives permission.
Packit 709fb3
Packit 709fb3
       B. List on the Title Page, as authors, one or more persons or
Packit 709fb3
          entities responsible for authorship of the modifications in
Packit 709fb3
          the Modified Version, together with at least five of the
Packit 709fb3
          principal authors of the Document (all of its principal
Packit 709fb3
          authors, if it has fewer than five), unless they release you
Packit 709fb3
          from this requirement.
Packit 709fb3
Packit 709fb3
       C. State on the Title page the name of the publisher of the
Packit 709fb3
          Modified Version, as the publisher.
Packit 709fb3
Packit 709fb3
       D. Preserve all the copyright notices of the Document.
Packit 709fb3
Packit 709fb3
       E. Add an appropriate copyright notice for your modifications
Packit 709fb3
          adjacent to the other copyright notices.
Packit 709fb3
Packit 709fb3
       F. Include, immediately after the copyright notices, a license
Packit 709fb3
          notice giving the public permission to use the Modified
Packit 709fb3
          Version under the terms of this License, in the form shown in
Packit 709fb3
          the Addendum below.
Packit 709fb3
Packit 709fb3
       G. Preserve in that license notice the full lists of Invariant
Packit 709fb3
          Sections and required Cover Texts given in the Document’s
Packit 709fb3
          license notice.
Packit 709fb3
Packit 709fb3
       H. Include an unaltered copy of this License.
Packit 709fb3
Packit 709fb3
       I. Preserve the section Entitled “History”, Preserve its Title,
Packit 709fb3
          and add to it an item stating at least the title, year, new
Packit 709fb3
          authors, and publisher of the Modified Version as given on the
Packit 709fb3
          Title Page.  If there is no section Entitled “History” in the
Packit 709fb3
          Document, create one stating the title, year, authors, and
Packit 709fb3
          publisher of the Document as given on its Title Page, then add
Packit 709fb3
          an item describing the Modified Version as stated in the
Packit 709fb3
          previous sentence.
Packit 709fb3
Packit 709fb3
       J. Preserve the network location, if any, given in the Document
Packit 709fb3
          for public access to a Transparent copy of the Document, and
Packit 709fb3
          likewise the network locations given in the Document for
Packit 709fb3
          previous versions it was based on.  These may be placed in the
Packit 709fb3
          “History” section.  You may omit a network location for a work
Packit 709fb3
          that was published at least four years before the Document
Packit 709fb3
          itself, or if the original publisher of the version it refers
Packit 709fb3
          to gives permission.
Packit 709fb3
Packit 709fb3
       K. For any section Entitled “Acknowledgements” or “Dedications”,
Packit 709fb3
          Preserve the Title of the section, and preserve in the section
Packit 709fb3
          all the substance and tone of each of the contributor
Packit 709fb3
          acknowledgements and/or dedications given therein.
Packit 709fb3
Packit 709fb3
       L. Preserve all the Invariant Sections of the Document, unaltered
Packit 709fb3
          in their text and in their titles.  Section numbers or the
Packit 709fb3
          equivalent are not considered part of the section titles.
Packit 709fb3
Packit 709fb3
       M. Delete any section Entitled “Endorsements”.  Such a section
Packit 709fb3
          may not be included in the Modified Version.
Packit 709fb3
Packit 709fb3
       N. Do not retitle any existing section to be Entitled
Packit 709fb3
          “Endorsements” or to conflict in title with any Invariant
Packit 709fb3
          Section.
Packit 709fb3
Packit 709fb3
       O. Preserve any Warranty Disclaimers.
Packit 709fb3
Packit 709fb3
     If the Modified Version includes new front-matter sections or
Packit 709fb3
     appendices that qualify as Secondary Sections and contain no
Packit 709fb3
     material copied from the Document, you may at your option designate
Packit 709fb3
     some or all of these sections as invariant.  To do this, add their
Packit 709fb3
     titles to the list of Invariant Sections in the Modified Version’s
Packit 709fb3
     license notice.  These titles must be distinct from any other
Packit 709fb3
     section titles.
Packit 709fb3
Packit 709fb3
     You may add a section Entitled “Endorsements”, provided it contains
Packit 709fb3
     nothing but endorsements of your Modified Version by various
Packit 709fb3
     parties—for example, statements of peer review or that the text has
Packit 709fb3
     been approved by an organization as the authoritative definition of
Packit 709fb3
     a standard.
Packit 709fb3
Packit 709fb3
     You may add a passage of up to five words as a Front-Cover Text,
Packit 709fb3
     and a passage of up to 25 words as a Back-Cover Text, to the end of
Packit 709fb3
     the list of Cover Texts in the Modified Version.  Only one passage
Packit 709fb3
     of Front-Cover Text and one of Back-Cover Text may be added by (or
Packit 709fb3
     through arrangements made by) any one entity.  If the Document
Packit 709fb3
     already includes a cover text for the same cover, previously added
Packit 709fb3
     by you or by arrangement made by the same entity you are acting on
Packit 709fb3
     behalf of, you may not add another; but you may replace the old
Packit 709fb3
     one, on explicit permission from the previous publisher that added
Packit 709fb3
     the old one.
Packit 709fb3
Packit 709fb3
     The author(s) and publisher(s) of the Document do not by this
Packit 709fb3
     License give permission to use their names for publicity for or to
Packit 709fb3
     assert or imply endorsement of any Modified Version.
Packit 709fb3
Packit 709fb3
  5. COMBINING DOCUMENTS
Packit 709fb3
Packit 709fb3
     You may combine the Document with other documents released under
Packit 709fb3
     this License, under the terms defined in section 4 above for
Packit 709fb3
     modified versions, provided that you include in the combination all
Packit 709fb3
     of the Invariant Sections of all of the original documents,
Packit 709fb3
     unmodified, and list them all as Invariant Sections of your
Packit 709fb3
     combined work in its license notice, and that you preserve all
Packit 709fb3
     their Warranty Disclaimers.
Packit 709fb3
Packit 709fb3
     The combined work need only contain one copy of this License, and
Packit 709fb3
     multiple identical Invariant Sections may be replaced with a single
Packit 709fb3
     copy.  If there are multiple Invariant Sections with the same name
Packit 709fb3
     but different contents, make the title of each such section unique
Packit 709fb3
     by adding at the end of it, in parentheses, the name of the
Packit 709fb3
     original author or publisher of that section if known, or else a
Packit 709fb3
     unique number.  Make the same adjustment to the section titles in
Packit 709fb3
     the list of Invariant Sections in the license notice of the
Packit 709fb3
     combined work.
Packit 709fb3
Packit 709fb3
     In the combination, you must combine any sections Entitled
Packit 709fb3
     “History” in the various original documents, forming one section
Packit 709fb3
     Entitled “History”; likewise combine any sections Entitled
Packit 709fb3
     “Acknowledgements”, and any sections Entitled “Dedications”.  You
Packit 709fb3
     must delete all sections Entitled “Endorsements.”
Packit 709fb3
Packit 709fb3
  6. COLLECTIONS OF DOCUMENTS
Packit 709fb3
Packit 709fb3
     You may make a collection consisting of the Document and other
Packit 709fb3
     documents released under this License, and replace the individual
Packit 709fb3
     copies of this License in the various documents with a single copy
Packit 709fb3
     that is included in the collection, provided that you follow the
Packit 709fb3
     rules of this License for verbatim copying of each of the documents
Packit 709fb3
     in all other respects.
Packit 709fb3
Packit 709fb3
     You may extract a single document from such a collection, and
Packit 709fb3
     distribute it individually under this License, provided you insert
Packit 709fb3
     a copy of this License into the extracted document, and follow this
Packit 709fb3
     License in all other respects regarding verbatim copying of that
Packit 709fb3
     document.
Packit 709fb3
Packit 709fb3
  7. AGGREGATION WITH INDEPENDENT WORKS
Packit 709fb3
Packit 709fb3
     A compilation of the Document or its derivatives with other
Packit 709fb3
     separate and independent documents or works, in or on a volume of a
Packit 709fb3
     storage or distribution medium, is called an “aggregate” if the
Packit 709fb3
     copyright resulting from the compilation is not used to limit the
Packit 709fb3
     legal rights of the compilation’s users beyond what the individual
Packit 709fb3
     works permit.  When the Document is included in an aggregate, this
Packit 709fb3
     License does not apply to the other works in the aggregate which
Packit 709fb3
     are not themselves derivative works of the Document.
Packit 709fb3
Packit 709fb3
     If the Cover Text requirement of section 3 is applicable to these
Packit 709fb3
     copies of the Document, then if the Document is less than one half
Packit 709fb3
     of the entire aggregate, the Document’s Cover Texts may be placed
Packit 709fb3
     on covers that bracket the Document within the aggregate, or the
Packit 709fb3
     electronic equivalent of covers if the Document is in electronic
Packit 709fb3
     form.  Otherwise they must appear on printed covers that bracket
Packit 709fb3
     the whole aggregate.
Packit 709fb3
Packit 709fb3
  8. TRANSLATION
Packit 709fb3
Packit 709fb3
     Translation is considered a kind of modification, so you may
Packit 709fb3
     distribute translations of the Document under the terms of section
Packit 709fb3
     4.  Replacing Invariant Sections with translations requires special
Packit 709fb3
     permission from their copyright holders, but you may include
Packit 709fb3
     translations of some or all Invariant Sections in addition to the
Packit 709fb3
     original versions of these Invariant Sections.  You may include a
Packit 709fb3
     translation of this License, and all the license notices in the
Packit 709fb3
     Document, and any Warranty Disclaimers, provided that you also
Packit 709fb3
     include the original English version of this License and the
Packit 709fb3
     original versions of those notices and disclaimers.  In case of a
Packit 709fb3
     disagreement between the translation and the original version of
Packit 709fb3
     this License or a notice or disclaimer, the original version will
Packit 709fb3
     prevail.
Packit 709fb3
Packit 709fb3
     If a section in the Document is Entitled “Acknowledgements”,
Packit 709fb3
     “Dedications”, or “History”, the requirement (section 4) to
Packit 709fb3
     Preserve its Title (section 1) will typically require changing the
Packit 709fb3
     actual title.
Packit 709fb3
Packit 709fb3
  9. TERMINATION
Packit 709fb3
Packit 709fb3
     You may not copy, modify, sublicense, or distribute the Document
Packit 709fb3
     except as expressly provided under this License.  Any attempt
Packit 709fb3
     otherwise to copy, modify, sublicense, or distribute it is void,
Packit 709fb3
     and will automatically terminate your rights under this License.
Packit 709fb3
Packit 709fb3
     However, if you cease all violation of this License, then your
Packit 709fb3
     license from a particular copyright holder is reinstated (a)
Packit 709fb3
     provisionally, unless and until the copyright holder explicitly and
Packit 709fb3
     finally terminates your license, and (b) permanently, if the
Packit 709fb3
     copyright holder fails to notify you of the violation by some
Packit 709fb3
     reasonable means prior to 60 days after the cessation.
Packit 709fb3
Packit 709fb3
     Moreover, your license from a particular copyright holder is
Packit 709fb3
     reinstated permanently if the copyright holder notifies you of the
Packit 709fb3
     violation by some reasonable means, this is the first time you have
Packit 709fb3
     received notice of violation of this License (for any work) from
Packit 709fb3
     that copyright holder, and you cure the violation prior to 30 days
Packit 709fb3
     after your receipt of the notice.
Packit 709fb3
Packit 709fb3
     Termination of your rights under this section does not terminate
Packit 709fb3
     the licenses of parties who have received copies or rights from you
Packit 709fb3
     under this License.  If your rights have been terminated and not
Packit 709fb3
     permanently reinstated, receipt of a copy of some or all of the
Packit 709fb3
     same material does not give you any rights to use it.
Packit 709fb3
Packit 709fb3
  10. FUTURE REVISIONS OF THIS LICENSE
Packit 709fb3
Packit 709fb3
     The Free Software Foundation may publish new, revised versions of
Packit 709fb3
     the GNU Free Documentation License from time to time.  Such new
Packit 709fb3
     versions will be similar in spirit to the present version, but may
Packit 709fb3
     differ in detail to address new problems or concerns.  See
Packit 709fb3
     <http://www.gnu.org/copyleft/>.
Packit 709fb3
Packit 709fb3
     Each version of the License is given a distinguishing version
Packit 709fb3
     number.  If the Document specifies that a particular numbered
Packit 709fb3
     version of this License “or any later version” applies to it, you
Packit 709fb3
     have the option of following the terms and conditions either of
Packit 709fb3
     that specified version or of any later version that has been
Packit 709fb3
     published (not as a draft) by the Free Software Foundation.  If the
Packit 709fb3
     Document does not specify a version number of this License, you may
Packit 709fb3
     choose any version ever published (not as a draft) by the Free
Packit 709fb3
     Software Foundation.  If the Document specifies that a proxy can
Packit 709fb3
     decide which future versions of this License can be used, that
Packit 709fb3
     proxy’s public statement of acceptance of a version permanently
Packit 709fb3
     authorizes you to choose that version for the Document.
Packit 709fb3
Packit 709fb3
  11. RELICENSING
Packit 709fb3
Packit 709fb3
     “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
Packit 709fb3
     World Wide Web server that publishes copyrightable works and also
Packit 709fb3
     provides prominent facilities for anybody to edit those works.  A
Packit 709fb3
     public wiki that anybody can edit is an example of such a server.
Packit 709fb3
     A “Massive Multiauthor Collaboration” (or “MMC”) contained in the
Packit 709fb3
     site means any set of copyrightable works thus published on the MMC
Packit 709fb3
     site.
Packit 709fb3
Packit 709fb3
     “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
Packit 709fb3
     license published by Creative Commons Corporation, a not-for-profit
Packit 709fb3
     corporation with a principal place of business in San Francisco,
Packit 709fb3
     California, as well as future copyleft versions of that license
Packit 709fb3
     published by that same organization.
Packit 709fb3
Packit 709fb3
     “Incorporate” means to publish or republish a Document, in whole or
Packit 709fb3
     in part, as part of another Document.
Packit 709fb3
Packit 709fb3
     An MMC is “eligible for relicensing” if it is licensed under this
Packit 709fb3
     License, and if all works that were first published under this
Packit 709fb3
     License somewhere other than this MMC, and subsequently
Packit 709fb3
     incorporated in whole or in part into the MMC, (1) had no cover
Packit 709fb3
     texts or invariant sections, and (2) were thus incorporated prior
Packit 709fb3
     to November 1, 2008.
Packit 709fb3
Packit 709fb3
     The operator of an MMC Site may republish an MMC contained in the
Packit 709fb3
     site under CC-BY-SA on the same site at any time before August 1,
Packit 709fb3
     2009, provided the MMC is eligible for relicensing.
Packit 709fb3
Packit 709fb3
ADDENDUM: How to use this License for your documents
Packit 709fb3
====================================================
Packit 709fb3
Packit 709fb3
To use this License in a document you have written, include a copy of
Packit 709fb3
the License in the document and put the following copyright and license
Packit 709fb3
notices just after the title page:
Packit 709fb3
Packit 709fb3
       Copyright (C)  YEAR  YOUR NAME.
Packit 709fb3
       Permission is granted to copy, distribute and/or modify this document
Packit 709fb3
       under the terms of the GNU Free Documentation License, Version 1.3
Packit 709fb3
       or any later version published by the Free Software Foundation;
Packit 709fb3
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Packit 709fb3
       Texts.  A copy of the license is included in the section entitled ``GNU
Packit 709fb3
       Free Documentation License''.
Packit 709fb3
Packit 709fb3
   If you have Invariant Sections, Front-Cover Texts and Back-Cover
Packit 709fb3
Texts, replace the “with...Texts.” line with this:
Packit 709fb3
Packit 709fb3
         with the Invariant Sections being LIST THEIR TITLES, with
Packit 709fb3
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
Packit 709fb3
         being LIST.
Packit 709fb3
Packit 709fb3
   If you have Invariant Sections without Cover Texts, or some other
Packit 709fb3
combination of the three, merge those two alternatives to suit the
Packit 709fb3
situation.
Packit 709fb3
Packit 709fb3
   If your document contains nontrivial examples of program code, we
Packit 709fb3
recommend releasing these examples in parallel under your choice of free
Packit 709fb3
software license, such as the GNU General Public License, to permit
Packit 709fb3
their use in free software.
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
File: grep.info-t,  Node: Index,  Prev: Copying,  Up: Top
Packit 709fb3
Packit 709fb3
Index
Packit 709fb3
*****
Packit 709fb3
Packit 709fb3
?[index?]
Packit 709fb3
* Menu:
Packit 709fb3
Packit 709fb3
* *:                                     Fundamental Structure.
Packit 709fb3
                                                              (line  21)
Packit 709fb3
* +:                                     Fundamental Structure.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* --after-context:                       Context Line Control.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* --basic-regexp:                        grep Programs.       (line  15)
Packit 709fb3
* --before-context:                      Context Line Control.
Packit 709fb3
                                                              (line  19)
Packit 709fb3
* --binary:                              Other Options.       (line  12)
Packit 709fb3
* --binary-files:                        File and Directory Selection.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* --byte-offset:                         Output Line Prefix Control.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* --color:                               General Output Control.
Packit 709fb3
                                                              (line  14)
Packit 709fb3
* --colour:                              General Output Control.
Packit 709fb3
                                                              (line  14)
Packit 709fb3
* --context:                             Context Line Control.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* --count:                               General Output Control.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* --dereference-recursive:               File and Directory Selection.
Packit 709fb3
                                                              (line 109)
Packit 709fb3
* --devices:                             File and Directory Selection.
Packit 709fb3
                                                              (line  51)
Packit 709fb3
* --directories:                         File and Directory Selection.
Packit 709fb3
                                                              (line  62)
Packit 709fb3
* --exclude:                             File and Directory Selection.
Packit 709fb3
                                                              (line  73)
Packit 709fb3
* --exclude-dir:                         File and Directory Selection.
Packit 709fb3
                                                              (line  86)
Packit 709fb3
* --exclude-from:                        File and Directory Selection.
Packit 709fb3
                                                              (line  82)
Packit 709fb3
* --extended-regexp:                     grep Programs.       (line  20)
Packit 709fb3
* --file:                                Matching Control.    (line  14)
Packit 709fb3
* --files-with-matches:                  General Output Control.
Packit 709fb3
                                                              (line  35)
Packit 709fb3
* --files-without-match:                 General Output Control.
Packit 709fb3
                                                              (line  29)
Packit 709fb3
* --fixed-strings:                       grep Programs.       (line  25)
Packit 709fb3
* --group-separator:                     Context Line Control.
Packit 709fb3
                                                              (line  27)
Packit 709fb3
* --group-separator <1>:                 Context Line Control.
Packit 709fb3
                                                              (line  31)
Packit 709fb3
* --help:                                Generic Program Information.
Packit 709fb3
                                                              (line   7)
Packit 709fb3
* --ignore-case:                         Matching Control.    (line  23)
Packit 709fb3
* --include:                             File and Directory Selection.
Packit 709fb3
                                                              (line  96)
Packit 709fb3
* --initial-tab:                         Output Line Prefix Control.
Packit 709fb3
                                                              (line  41)
Packit 709fb3
* --invert-match:                        Matching Control.    (line  42)
Packit 709fb3
* --label:                               Output Line Prefix Control.
Packit 709fb3
                                                              (line  28)
Packit 709fb3
* --line-buffered:                       Other Options.       (line   7)
Packit 709fb3
* --line-number:                         Output Line Prefix Control.
Packit 709fb3
                                                              (line  36)
Packit 709fb3
* --line-regexp:                         Matching Control.    (line  57)
Packit 709fb3
* --max-count:                           General Output Control.
Packit 709fb3
                                                              (line  42)
Packit 709fb3
* --no-filename:                         Output Line Prefix Control.
Packit 709fb3
                                                              (line  23)
Packit 709fb3
* --no-messages:                         General Output Control.
Packit 709fb3
                                                              (line  87)
Packit 709fb3
* --null:                                Output Line Prefix Control.
Packit 709fb3
                                                              (line  50)
Packit 709fb3
* --null-data:                           Other Options.       (line  33)
Packit 709fb3
* --only-matching:                       General Output Control.
Packit 709fb3
                                                              (line  72)
Packit 709fb3
* --perl-regexp:                         grep Programs.       (line  31)
Packit 709fb3
* --quiet:                               General Output Control.
Packit 709fb3
                                                              (line  80)
Packit 709fb3
* --recursive:                           File and Directory Selection.
Packit 709fb3
                                                              (line 101)
Packit 709fb3
* --regexp=PATTERN:                      Matching Control.    (line   8)
Packit 709fb3
* --silent:                              General Output Control.
Packit 709fb3
                                                              (line  80)
Packit 709fb3
* --text:                                File and Directory Selection.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* --version:                             Generic Program Information.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* --with-filename:                       Output Line Prefix Control.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* --word-regexp:                         Matching Control.    (line  47)
Packit 709fb3
* -A:                                    Context Line Control.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* -a:                                    File and Directory Selection.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* -b:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* -B:                                    Context Line Control.
Packit 709fb3
                                                              (line  19)
Packit 709fb3
* -c:                                    General Output Control.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* -C:                                    Context Line Control.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* -D:                                    File and Directory Selection.
Packit 709fb3
                                                              (line  51)
Packit 709fb3
* -d:                                    File and Directory Selection.
Packit 709fb3
                                                              (line  62)
Packit 709fb3
* -e:                                    Matching Control.    (line   8)
Packit 709fb3
* -E:                                    grep Programs.       (line  20)
Packit 709fb3
* -f:                                    Matching Control.    (line  14)
Packit 709fb3
* -F:                                    grep Programs.       (line  25)
Packit 709fb3
* -G:                                    grep Programs.       (line  15)
Packit 709fb3
* -H:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* -h:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  23)
Packit 709fb3
* -i:                                    Matching Control.    (line  23)
Packit 709fb3
* -L:                                    General Output Control.
Packit 709fb3
                                                              (line  29)
Packit 709fb3
* -l:                                    General Output Control.
Packit 709fb3
                                                              (line  35)
Packit 709fb3
* -m:                                    General Output Control.
Packit 709fb3
                                                              (line  42)
Packit 709fb3
* -n:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  36)
Packit 709fb3
* -NUM:                                  Context Line Control.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* -o:                                    General Output Control.
Packit 709fb3
                                                              (line  72)
Packit 709fb3
* -P:                                    grep Programs.       (line  31)
Packit 709fb3
* -q:                                    General Output Control.
Packit 709fb3
                                                              (line  80)
Packit 709fb3
* -r:                                    File and Directory Selection.
Packit 709fb3
                                                              (line 101)
Packit 709fb3
* -R:                                    File and Directory Selection.
Packit 709fb3
                                                              (line 109)
Packit 709fb3
* -s:                                    General Output Control.
Packit 709fb3
                                                              (line  87)
Packit 709fb3
* -T:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  41)
Packit 709fb3
* -U:                                    Other Options.       (line  12)
Packit 709fb3
* -V:                                    Generic Program Information.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* -v:                                    Matching Control.    (line  42)
Packit 709fb3
* -w:                                    Matching Control.    (line  47)
Packit 709fb3
* -x:                                    Matching Control.    (line  57)
Packit 709fb3
* -y:                                    Matching Control.    (line  23)
Packit 709fb3
* -Z:                                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  50)
Packit 709fb3
* -z:                                    Other Options.       (line  33)
Packit 709fb3
* .:                                     Fundamental Structure.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* ?:                                     Fundamental Structure.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* _N_GNU_nonoption_argv_flags_ environment variable: Environment Variables.
Packit 709fb3
                                                              (line 193)
Packit 709fb3
* {,M}:                                  Fundamental Structure.
Packit 709fb3
                                                              (line  33)
Packit 709fb3
* {N,M}:                                 Fundamental Structure.
Packit 709fb3
                                                              (line  37)
Packit 709fb3
* {N,}:                                  Fundamental Structure.
Packit 709fb3
                                                              (line  30)
Packit 709fb3
* {N}:                                   Fundamental Structure.
Packit 709fb3
                                                              (line  27)
Packit 709fb3
* after context:                         Context Line Control.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* alnum character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  29)
Packit 709fb3
* alpha character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  34)
Packit 709fb3
* alphabetic characters:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  34)
Packit 709fb3
* alphanumeric characters:               Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  29)
Packit 709fb3
* anchoring:                             Anchoring.           (line   6)
Packit 709fb3
* asterisk:                              Fundamental Structure.
Packit 709fb3
                                                              (line  21)
Packit 709fb3
* back-reference:                        Back-references and Subexpressions.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* back-references:                       Performance.         (line  32)
Packit 709fb3
* backslash:                             The Backslash Character and Special Expressions.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* basic regular expressions:             Basic vs Extended.   (line   6)
Packit 709fb3
* before context:                        Context Line Control.
Packit 709fb3
                                                              (line  19)
Packit 709fb3
* binary files:                          File and Directory Selection.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* binary files <1>:                      File and Directory Selection.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* binary I/O:                            Other Options.       (line  12)
Packit 709fb3
* blank character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  39)
Packit 709fb3
* blank characters:                      Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  39)
Packit 709fb3
* bn GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 134)
Packit 709fb3
* braces, first argument omitted:        Fundamental Structure.
Packit 709fb3
                                                              (line  33)
Packit 709fb3
* braces, one argument:                  Fundamental Structure.
Packit 709fb3
                                                              (line  27)
Packit 709fb3
* braces, second argument omitted:       Fundamental Structure.
Packit 709fb3
                                                              (line  30)
Packit 709fb3
* braces, two arguments:                 Fundamental Structure.
Packit 709fb3
                                                              (line  37)
Packit 709fb3
* bracket expression:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* Bugs, known:                           Reporting Bugs.      (line  14)
Packit 709fb3
* bugs, reporting:                       Reporting Bugs.      (line   6)
Packit 709fb3
* byte offset:                           Output Line Prefix Control.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* case insensitive search:               Matching Control.    (line  23)
Packit 709fb3
* case insensitive search <1>:           Performance.         (line  27)
Packit 709fb3
* changing name of standard input:       Output Line Prefix Control.
Packit 709fb3
                                                              (line  28)
Packit 709fb3
* character class:                       Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* character classes:                     Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  28)
Packit 709fb3
* character type:                        Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* classes of characters:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  28)
Packit 709fb3
* cntrl character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  42)
Packit 709fb3
* context lines:                         General Output Control.
Packit 709fb3
                                                              (line  64)
Packit 709fb3
* context lines <1>:                     Context Line Control.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* context lines <2>:                     Context Line Control.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* context lines, after match:            Context Line Control.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* context lines, before match:           Context Line Control.
Packit 709fb3
                                                              (line  19)
Packit 709fb3
* control characters:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  42)
Packit 709fb3
* copying:                               Copying.             (line   6)
Packit 709fb3
* counting lines:                        General Output Control.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* cx GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line  85)
Packit 709fb3
* default options environment variable:  Environment Variables.
Packit 709fb3
                                                              (line  45)
Packit 709fb3
* device search:                         File and Directory Selection.
Packit 709fb3
                                                              (line  51)
Packit 709fb3
* digit character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  47)
Packit 709fb3
* digit characters:                      Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  47)
Packit 709fb3
* directory search:                      File and Directory Selection.
Packit 709fb3
                                                              (line  62)
Packit 709fb3
* dot:                                   Fundamental Structure.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* environment variables:                 Environment Variables.
Packit 709fb3
                                                              (line  44)
Packit 709fb3
* exclude directories:                   File and Directory Selection.
Packit 709fb3
                                                              (line  86)
Packit 709fb3
* exclude files:                         File and Directory Selection.
Packit 709fb3
                                                              (line  73)
Packit 709fb3
* exclude files <1>:                     File and Directory Selection.
Packit 709fb3
                                                              (line  82)
Packit 709fb3
* exit status:                           Exit Status.         (line   6)
Packit 709fb3
* FAQ about grep usage:                  Usage.               (line  17)
Packit 709fb3
* files which don’t match:               General Output Control.
Packit 709fb3
                                                              (line  29)
Packit 709fb3
* fn GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 124)
Packit 709fb3
* fn GREP_COLORS capability <1>:         Environment Variables.
Packit 709fb3
                                                              (line 139)
Packit 709fb3
* graph character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  50)
Packit 709fb3
* graphic characters:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  50)
Packit 709fb3
* grep programs:                         grep Programs.       (line   6)
Packit 709fb3
* GREP_COLOR environment variable:       Environment Variables.
Packit 709fb3
                                                              (line  58)
Packit 709fb3
* GREP_COLORS environment variable:      Environment Variables.
Packit 709fb3
                                                              (line  69)
Packit 709fb3
* GREP_OPTIONS environment variable:     Environment Variables.
Packit 709fb3
                                                              (line  45)
Packit 709fb3
* group separator:                       Context Line Control.
Packit 709fb3
                                                              (line  27)
Packit 709fb3
* group separator <1>:                   Context Line Control.
Packit 709fb3
                                                              (line  31)
Packit 709fb3
* hexadecimal digits:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  74)
Packit 709fb3
* highlight markers:                     Environment Variables.
Packit 709fb3
                                                              (line  58)
Packit 709fb3
* highlight markers <1>:                 Environment Variables.
Packit 709fb3
                                                              (line  69)
Packit 709fb3
* highlight, color, colour:              General Output Control.
Packit 709fb3
                                                              (line  14)
Packit 709fb3
* holes in files:                        Performance.         (line  42)
Packit 709fb3
* include files:                         File and Directory Selection.
Packit 709fb3
                                                              (line  96)
Packit 709fb3
* interval specifications:               Basic vs Extended.   (line  10)
Packit 709fb3
* invert matching:                       Matching Control.    (line  42)
Packit 709fb3
* LANG environment variable:             Environment Variables.
Packit 709fb3
                                                              (line   9)
Packit 709fb3
* LANG environment variable <1>:         Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* LANG environment variable <2>:         Environment Variables.
Packit 709fb3
                                                              (line 168)
Packit 709fb3
* LANG environment variable <3>:         Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* LANGUAGE environment variable:         Environment Variables.
Packit 709fb3
                                                              (line   9)
Packit 709fb3
* LANGUAGE environment variable <1>:     Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* language of messages:                  Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* LC_ALL environment variable:           Environment Variables.
Packit 709fb3
                                                              (line   9)
Packit 709fb3
* LC_ALL environment variable <1>:       Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* LC_ALL environment variable <2>:       Environment Variables.
Packit 709fb3
                                                              (line 168)
Packit 709fb3
* LC_ALL environment variable <3>:       Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* LC_COLLATE environment variable:       Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* LC_CTYPE environment variable:         Environment Variables.
Packit 709fb3
                                                              (line 168)
Packit 709fb3
* LC_MESSAGES environment variable:      Environment Variables.
Packit 709fb3
                                                              (line   9)
Packit 709fb3
* LC_MESSAGES environment variable <1>:  Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* line buffering:                        Other Options.       (line   7)
Packit 709fb3
* line numbering:                        Output Line Prefix Control.
Packit 709fb3
                                                              (line  36)
Packit 709fb3
* ln GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 129)
Packit 709fb3
* locales:                               Performance.         (line  20)
Packit 709fb3
* lower character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  53)
Packit 709fb3
* lower-case letters:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  53)
Packit 709fb3
* match expression at most M times:      Fundamental Structure.
Packit 709fb3
                                                              (line  33)
Packit 709fb3
* match expression at most once:         Fundamental Structure.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* match expression from N to M times:    Fundamental Structure.
Packit 709fb3
                                                              (line  37)
Packit 709fb3
* match expression N or more times:      Fundamental Structure.
Packit 709fb3
                                                              (line  30)
Packit 709fb3
* match expression N times:              Fundamental Structure.
Packit 709fb3
                                                              (line  27)
Packit 709fb3
* match expression one or more times:    Fundamental Structure.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* match expression zero or more times:   Fundamental Structure.
Packit 709fb3
                                                              (line  21)
Packit 709fb3
* match the whole line:                  Matching Control.    (line  57)
Packit 709fb3
* matching basic regular expressions:    grep Programs.       (line  15)
Packit 709fb3
* matching extended regular expressions: grep Programs.       (line  20)
Packit 709fb3
* matching fixed strings:                grep Programs.       (line  25)
Packit 709fb3
* matching Perl-compatible regular expressions: grep Programs.
Packit 709fb3
                                                              (line  31)
Packit 709fb3
* matching whole words:                  Matching Control.    (line  47)
Packit 709fb3
* max-count:                             General Output Control.
Packit 709fb3
                                                              (line  42)
Packit 709fb3
* mc GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 116)
Packit 709fb3
* message language:                      Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* ms GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 108)
Packit 709fb3
* MS-Windows binary I/O:                 Other Options.       (line  12)
Packit 709fb3
* mt GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 100)
Packit 709fb3
* names of matching files:               General Output Control.
Packit 709fb3
                                                              (line  35)
Packit 709fb3
* national language support:             Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* national language support <1>:         Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* ne GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line 146)
Packit 709fb3
* NLS:                                   Environment Variables.
Packit 709fb3
                                                              (line 161)
Packit 709fb3
* no filename prefix:                    Output Line Prefix Control.
Packit 709fb3
                                                              (line  23)
Packit 709fb3
* numeric characters:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  47)
Packit 709fb3
* only matching:                         General Output Control.
Packit 709fb3
                                                              (line  72)
Packit 709fb3
* palindromes:                           Usage.               (line 139)
Packit 709fb3
* pattern from file:                     Matching Control.    (line  14)
Packit 709fb3
* pattern list:                          Matching Control.    (line   8)
Packit 709fb3
* performance:                           Performance.         (line   6)
Packit 709fb3
* period:                                Fundamental Structure.
Packit 709fb3
                                                              (line  15)
Packit 709fb3
* plus sign:                             Fundamental Structure.
Packit 709fb3
                                                              (line  24)
Packit 709fb3
* POSIXLY_CORRECT environment variable:  Environment Variables.
Packit 709fb3
                                                              (line 184)
Packit 709fb3
* print character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  57)
Packit 709fb3
* print non-matching lines:              Matching Control.    (line  42)
Packit 709fb3
* printable characters:                  Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  57)
Packit 709fb3
* punct character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  60)
Packit 709fb3
* punctuation characters:                Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  60)
Packit 709fb3
* question mark:                         Fundamental Structure.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* quiet, silent:                         General Output Control.
Packit 709fb3
                                                              (line  80)
Packit 709fb3
* range expression:                      Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* recursive search:                      File and Directory Selection.
Packit 709fb3
                                                              (line 101)
Packit 709fb3
* recursive search <1>:                  File and Directory Selection.
Packit 709fb3
                                                              (line 109)
Packit 709fb3
* regular expressions:                   Regular Expressions. (line   6)
Packit 709fb3
* return status:                         Exit Status.         (line   6)
Packit 709fb3
* rv GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line  94)
Packit 709fb3
* searching directory trees:             File and Directory Selection.
Packit 709fb3
                                                              (line  73)
Packit 709fb3
* searching directory trees <1>:         File and Directory Selection.
Packit 709fb3
                                                              (line  82)
Packit 709fb3
* searching directory trees <2>:         File and Directory Selection.
Packit 709fb3
                                                              (line  96)
Packit 709fb3
* searching directory trees <3>:         File and Directory Selection.
Packit 709fb3
                                                              (line 101)
Packit 709fb3
* searching directory trees <4>:         File and Directory Selection.
Packit 709fb3
                                                              (line 109)
Packit 709fb3
* searching for a pattern:               Introduction.        (line   6)
Packit 709fb3
* sl GREP_COLORS capability:             Environment Variables.
Packit 709fb3
                                                              (line  77)
Packit 709fb3
* space character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  65)
Packit 709fb3
* space characters:                      Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  65)
Packit 709fb3
* subexpression:                         Back-references and Subexpressions.
Packit 709fb3
                                                              (line   6)
Packit 709fb3
* suppress binary data:                  File and Directory Selection.
Packit 709fb3
                                                              (line   8)
Packit 709fb3
* suppress error messages:               General Output Control.
Packit 709fb3
                                                              (line  87)
Packit 709fb3
* symbolic links:                        File and Directory Selection.
Packit 709fb3
                                                              (line  62)
Packit 709fb3
* symbolic links <1>:                    File and Directory Selection.
Packit 709fb3
                                                              (line 101)
Packit 709fb3
* symbolic links <2>:                    File and Directory Selection.
Packit 709fb3
                                                              (line 109)
Packit 709fb3
* tab-aligned content lines:             Output Line Prefix Control.
Packit 709fb3
                                                              (line  41)
Packit 709fb3
* translation of message language:       Environment Variables.
Packit 709fb3
                                                              (line 179)
Packit 709fb3
* upper character class:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  70)
Packit 709fb3
* upper-case letters:                    Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  70)
Packit 709fb3
* usage summary, printing:               Generic Program Information.
Packit 709fb3
                                                              (line   7)
Packit 709fb3
* usage, examples:                       Usage.               (line   6)
Packit 709fb3
* using grep, Q&A:                       Usage.               (line  17)
Packit 709fb3
* variants of grep:                      grep Programs.       (line   6)
Packit 709fb3
* version, printing:                     Generic Program Information.
Packit 709fb3
                                                              (line  12)
Packit 709fb3
* whitespace characters:                 Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  65)
Packit 709fb3
* with filename prefix:                  Output Line Prefix Control.
Packit 709fb3
                                                              (line  18)
Packit 709fb3
* xdigit character class:                Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  74)
Packit 709fb3
* xdigit class:                          Character Classes and Bracket Expressions.
Packit 709fb3
                                                              (line  74)
Packit 709fb3
* zero-terminated file names:            Output Line Prefix Control.
Packit 709fb3
                                                              (line  50)
Packit 709fb3
* zero-terminated lines:                 Other Options.       (line  33)
Packit 709fb3
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
Tag Table:
Packit 709fb3
Node: Top770
Packit 709fb3
Node: Introduction1949
Packit 709fb3
Node: Invoking2691
Packit 709fb3
Node: Command-line Options3464
Packit 709fb3
Node: Generic Program Information4349
Packit 709fb3
Node: Matching Control4825
Packit 709fb3
Node: General Output Control7548
Packit 709fb3
Ref: General Output Control-Footnote-111711
Packit 709fb3
Node: Output Line Prefix Control11780
Packit 709fb3
Node: Context Line Control14116
Packit 709fb3
Node: File and Directory Selection16181
Packit 709fb3
Node: Other Options21689
Packit 709fb3
Node: Environment Variables23346
Packit 709fb3
Node: Exit Status33625
Packit 709fb3
Node: grep Programs34105
Packit 709fb3
Node: Regular Expressions35778
Packit 709fb3
Node: Fundamental Structure36975
Packit 709fb3
Node: Character Classes and Bracket Expressions38783
Packit 709fb3
Ref: invalid-bracket-expr42205
Packit 709fb3
Node: The Backslash Character and Special Expressions43445
Packit 709fb3
Node: Anchoring44519
Packit 709fb3
Node: Back-references and Subexpressions44980
Packit 709fb3
Node: Basic vs Extended45720
Packit 709fb3
Node: Usage46813
Packit 709fb3
Node: Performance54291
Packit 709fb3
Node: Reporting Bugs57976
Packit 709fb3
Node: Copying58666
Packit 709fb3
Node: GNU Free Documentation License59794
Packit 709fb3
Node: Index85099
Packit 709fb3
?
Packit 709fb3
End Tag Table
Packit 709fb3
Packit 709fb3
?
Packit 709fb3
Local Variables:
Packit 709fb3
coding: utf-8
Packit 709fb3
End: