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/fgrep.1.man.txt
          +++ new/usr/src/man/man1/fgrep.1.man.txt
   1    1  FGREP(1)                         User Commands                        FGREP(1)
   2    2  
   3    3  
   4    4  
   5    5  NAME
   6    6         fgrep - search a file for a fixed-character string
   7    7  
   8    8  SYNOPSIS
   9      -       /usr/bin/fgrep [-bcHhilnqsvx] -e pattern_list [file...]
  10      -
  11      -
  12      -       /usr/bin/fgrep [-bcHhilnqsvx] -f file [file...]
  13      -
  14      -
  15      -       /usr/bin/fgrep [-bcHhilnqsvx] pattern [file...]
  16      -
  17      -
  18      -       /usr/xpg4/bin/fgrep [-bcHhilnqsvx] -e pattern_list [-f file]
        9 +       /usr/bin/fgrep [-bcHhilnqsvx] -e pattern_list [-f file]
  19   10              [file...]
  20   11  
  21   12  
  22      -       /usr/xpg4/bin/fgrep [-bcHhilnqsvx] [-e pattern_list] -f file
       13 +       /usr/bin/fgrep [-bcHhilnqsvx] [-e pattern_list] -f file
  23   14              [file...]
  24   15  
  25   16  
  26      -       /usr/xpg4/bin/fgrep [-bcHhilnqsvx] pattern [file...]
       17 +       /usr/bin/fgrep [-bcHhilnqsvx] pattern [file...]
  27   18  
  28   19  
  29   20  DESCRIPTION
  30   21         The fgrep (fast grep) utility searches files for a character string and
  31   22         prints all lines that contain that string. fgrep is different from
  32   23         grep(1) and from egrep(1) because it searches for a string, instead of
  33   24         searching for a pattern that matches an expression. fgrep uses a fast
  34   25         and compact algorithm.
  35   26  
  36   27  
↓ open down ↓ 3 lines elided ↑ open up ↑
  40   31         Therefore, to be safe, enclose the entire string within single quotes
  41   32         (a').
  42   33  
  43   34  
  44   35         If no files are specified, fgrep assumes standard input. Normally, each
  45   36         line that is found is copied to the standard output. The file name is
  46   37         printed before each line that is found if there is more than one input
  47   38         file.
  48   39  
  49   40  OPTIONS
  50      -       The following options are supported for both /usr/bin/fgrep and
  51      -       /usr/xpg4/bin/fgrep:
       41 +       The following options are supported:
  52   42  
  53   43         -b
  54      -                          Precedes each line by the block number on which the
  55      -                          line was found. This can be useful in locating block
  56      -                          numbers by context. The first block is 0.
       44 +             Precedes each line by the block number on which the line was
       45 +             found. This can be useful in locating block numbers by context.
       46 +             The first block is 0.
  57   47  
  58   48  
  59   49         -c
  60      -                          Prints only a count of the lines that contain the
  61      -                          pattern.
       50 +             Prints only a count of the lines that contain the pattern.
  62   51  
  63   52  
  64   53         -e pattern_list
  65      -                          Searches for a string in pattern-list. This is
  66      -                          useful when the string begins with a -.
       54 +             Searches for a string in pattern-list. This is useful when the
       55 +             string begins with a -.
  67   56  
  68   57  
  69   58         -f pattern-file
  70      -                          Takes the list of patterns from pattern-file.
       59 +             Takes the list of patterns from pattern-file.
  71   60  
  72   61  
  73   62         -H
  74      -                          Precedes each line by the name of the file
  75      -                          containing the matching line.
       63 +             Precedes each line by the name of the file containing the
       64 +             matching line.
  76   65  
  77   66  
  78   67         -h
  79      -                          Suppresses printing of files when searching multiple
  80      -                          files.
       68 +             Suppresses printing of files when searching multiple files.
  81   69  
  82   70  
  83   71         -i
  84      -                          Ignores upper/lower case distinction during
  85      -                          comparisons.
       72 +             Ignores upper/lower case distinction during comparisons.
  86   73  
  87   74  
  88   75         -l
  89      -                          Prints the names of files with matching lines once,
  90      -                          separated by new-lines.  Does not repeat the names
  91      -                          of files when the pattern is found more than once.
       76 +             Prints the names of files with matching lines once, separated by
       77 +             new-lines.  Does not repeat the names of files when the pattern
       78 +             is found more than once.
  92   79  
  93   80  
  94   81         -n
  95      -                          Precedes each line by its line number in the file.
  96      -                          The first line is 1.
       82 +             Precedes each line by its line number in the file. The first line
       83 +             is 1.
  97   84  
  98   85  
  99   86         -q
 100      -                          Quiet. Does not write anything to the standard
 101      -                          output, regardless of matching lines. Exits with
 102      -                          zero status if an input line is selected.
       87 +             Quiet. Does not write anything to the standard output, regardless
       88 +             of matching lines. Exits with zero status if an input line is
       89 +             selected.
 103   90  
 104   91  
 105   92         -s
 106      -                          Legacy equivalent of -q.
       93 +             Legacy equivalent of -q.
 107   94  
 108   95  
 109   96         -v
 110      -                          Prints all lines except those that contain the
 111      -                          pattern.
       97 +             Prints all lines except those that contain the pattern.
 112   98  
 113   99  
 114  100         -x
 115      -                          Prints only lines that are matched entirely.
      101 +             Prints only lines that are matched entirely.
 116  102  
 117  103  
 118  104  OPERANDS
 119  105         The following operands are supported:
 120  106  
 121  107         file
 122  108                 Specifies a path name of a file to be searched for the
 123  109                 patterns. If no file operands are specified, the standard input
 124  110                 will be used.
 125  111  
 126      -
 127      -   /usr/bin/fgrep
 128  112         pattern
 129      -                  Specifies a pattern to be used during the search for input.
 130      -
 131      -
 132      -   /usr/xpg4/bin/fgrep
 133      -       pattern
 134      -                  Specifies one or more patterns to be used during the search
 135      -                  for input. This operand is treated as if it were specified
 136      -                  as -e pattern_list.
      113 +               Specifies one or more patterns to be used during the search for
      114 +               input. This operand is treated as if it were specified as -e
      115 +               pattern_list.
 137  116  
 138  117  
 139  118  USAGE
 140  119         See largefile(5) for the description of the behavior of fgrep when
 141  120         encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 142  121  
 143  122  ENVIRONMENT VARIABLES
 144  123         See environ(5) for descriptions of the following environment variables
 145  124         that affect the execution of fgrep: LC_COLLATE, LC_CTYPE, LC_MESSAGES,
 146  125         and NLSPATH.
↓ open down ↓ 7 lines elided ↑ open up ↑
 154  133  
 155  134         1
 156  135              If no matches are found
 157  136  
 158  137  
 159  138         2
 160  139              For syntax errors or inaccessible files, even if matches were
 161  140              found.
 162  141  
 163  142  
 164      -   /usr/xpg4/bin/fgrep
 165      -
 166  143  ATTRIBUTES
 167  144         See attributes(5) for descriptions of the following attributes:
 168  145  
 169  146  
 170  147         +---------------+-----------------+
 171  148         |ATTRIBUTE TYPE | ATTRIBUTE VALUE |
 172  149         +---------------+-----------------+
 173  150         |CSI            | Enabled         |
 174  151         +---------------+-----------------+
 175  152  
↓ open down ↓ 2 lines elided ↑ open up ↑
 178  155         largefile(5), XPG4(5)
 179  156  
 180  157  NOTES
 181  158         Ideally, there should be only one grep command, but there is not a
 182  159         single algorithm that spans a wide enough range of space-time
 183  160         tradeoffs.
 184  161  
 185  162  
 186  163         Lines are limited only by the size of the available virtual memory.
 187  164  
 188      -   /usr/xpg4/bin/fgrep
 189      -       The /usr/xpg4/bin/fgrep utility is identical to /usr/xpg4/bin/grep -F
 190      -       (see grep(1)). Portable applications should use /usr/xpg4/bin/grep -F.
      165 +       The /usr/bin/fgrep utility is identical to /usr/bin/grep -F (see
      166 +       grep(1)). Portable applications should use /usr/bin/grep -F.
      167 +
      168 +       In the past the behavior of /usr/xpg4/bin/fgrep and /usr/bin/fgrep
      169 +       utilities was different. Now /usr/bin/fgrep is replaced by
      170 +       /usr/xpg4/bin/fgrep.
 191  171  
 192  172  
 193  173  
 194      -                                  May 3, 2013                         FGREP(1)
      174 +                               November 28, 2017                      FGREP(1)
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX