1 EGREP(1)                         User Commands                        EGREP(1)
   2 
   3 
   4 
   5 NAME
   6        egrep - search a file for a pattern using full regular expressions
   7 
   8 SYNOPSIS
   9        /usr/bin/egrep [-bcHhilnqsvx] -e pattern_list [-f file]
  10             [file...]
  11 
  12 
  13        /usr/bin/egrep [-bcHhilnqsvx] [-e pattern_list] -f file
  14             [file...]
  15 
  16 
  17        /usr/bin/egrep [-bcHhilnqsvx] pattern [file...]
  18 
  19 
  20 DESCRIPTION
  21        The egrep (expression grep) utility searches files for a pattern of
  22        characters and prints all lines that contain that pattern. egrep uses
  23        full regular expressions (expressions that have string values that use
  24        the full set of alphanumeric and special characters) to match the
  25        patterns. It uses a fast deterministic algorithm that sometimes needs
  26        exponential space.
  27 
  28 
  29        If no files are specified, egrep assumes standard input. Normally, each
  30        line found is copied to the standard output. The file name is printed
  31        before each line found if there is more than one input file.
  32 
  33        The egrep utility accepts the same form of full regular expressions as
  34        grep(1) -E option.
  35 
  36 
  37        Be careful using the characters $, *, [, ^, |, (, ), and \ in full
  38        regular expression, because they are also meaningful to the shell. It
  39        is safest to enclose the entire full regular expression in single
  40        quotes (a'a').
  41 
  42 
  43        The order of precedence of operators is [], then *?+, then
  44        concatenation, then | and NEWLINE.
  45 
  46 OPTIONS
  47        The following options are supported:
  48 
  49        -b
  50              Precede each line by the block number on which it was found. This
  51              can be useful in locating block numbers by context (first block
  52              is 0).
  53 
  54 
  55        -c
  56              Print only a count of the lines that contain the pattern.
  57 
  58 
  59        -e pattern_list
  60              Search for a pattern_list (full regular expression that begins
  61              with a -).
  62 
  63 
  64        -f file
  65              Take the list of full regular expressions from file.
  66 
  67 
  68        -H
  69              Precedes each line by the name of the file containing the
  70              matching line.
  71 
  72 
  73        -h
  74              Suppress printing of filenames when searching multiple files.
  75 
  76 
  77        -i
  78              Ignore upper/lower case distinction during comparisons.
  79 
  80 
  81        -l
  82              Print the names of files with matching lines once, separated by
  83              NEWLINEs. Does not repeat the names of files when the pattern is
  84              found more than once.
  85 
  86 
  87        -n
  88              Precede each line by its line number in the file (first line is
  89              1).
  90 
  91 
  92        -q
  93              Quiet. Does not write anything to the standard output, regardless
  94              of matching lines. Exits with zero status if an input line is
  95              selected.
  96 
  97 
  98        -s
  99              Legacy equivalent of -q.
 100 
 101 
 102        -v
 103              Print all lines except those that contain the pattern.
 104 
 105 
 106        -x
 107              Consider only input lines that use all characters in the line to
 108              match an entire fixed string or regular expression to be matching
 109              lines.
 110 
 111 
 112 OPERANDS
 113        The following operands are supported:
 114 
 115        file
 116                A path name of a file to be searched for the patterns. If no
 117                file operands are specified, the standard input is used.
 118 
 119        pattern
 120                Specify one or more patterns to be used during the search for
 121                input. This operand is treated as if it were specified as
 122                -epattern_list.
 123 
 124 
 125 USAGE
 126        See largefile(5) for the description of the behavior of egrep when
 127        encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 128 
 129 ENVIRONMENT VARIABLES
 130        See environ(5) for descriptions of the following environment variables
 131        that affect the execution of egrep: LC_COLLATE, LC_CTYPE, LC_MESSAGES,
 132        and NLSPATH.
 133 
 134 EXIT STATUS
 135        The following exit values are returned:
 136 
 137        0
 138             If any matches are found.
 139 
 140 
 141        1
 142             If no matches are found.
 143 
 144 
 145        2
 146             For syntax errors or inaccessible files (even if matches were
 147             found).
 148 
 149 
 150 ATTRIBUTES
 151        See attributes(5) for descriptions of the following attributes:
 152 
 153 
 154 
 155        +---------------+-----------------+
 156        |ATTRIBUTE TYPE | ATTRIBUTE VALUE |
 157        +---------------+-----------------+
 158        |CSI            | Enabled         |
 159        +---------------+-----------------+
 160 
 161 SEE ALSO
 162        fgrep(1), grep(1), sed(1), sh(1), attributes(5), environ(5),
 163        largefile(5), regex(5), regexp(5), XPG4(5)
 164 
 165 NOTES
 166        Ideally there should be only one grep command, but there is not a
 167        single algorithm that spans a wide enough range of space-time trade-
 168        offs.
 169 
 170 
 171        Lines are limited only by the size of the available virtual memory.
 172 
 173        The /usr/bin/egrep utility is identical to /usr/bin/grep -E. See
 174        grep(1). Portable applications should use /usr/bin/grep -E.
 175 
 176        In the past the behavior of /usr/xpg4/bin/egrep and /usr/bin/egrep
 177        utilities was different. Now /usr/bin/egrep is replaced by
 178        /usr/xpg4/bin/egrep.
 179 
 180 
 181 
 182                                November 28, 2017                      EGREP(1)