Print this page
8858 /usr/bin/grep doesn't support -E option
4580 /usr/bin/grep can't handle multibyte characters
8929 8868 tests are not delivered with system/test/utiltest
8860 Example in grep(1) is incorrect
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuripv@gmx.com>

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