Print this page
4701 would like grep context options (-A, -B, -C)

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/grep.1
          +++ new/usr/src/man/man1/grep.1
↓ open down ↓ 42 lines elided ↑ open up ↑
  43   43  .SH DESCRIPTION
  44   44  .sp
  45   45  .LP
  46   46  The \fBgrep\fR utility searches text files for a pattern and prints all lines
  47   47  that contain that pattern.  It uses a compact non-deterministic algorithm.
  48   48  .sp
  49   49  .LP
  50   50  Be careful using the characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, \fB|\fR,
  51   51  \fB(\fR, \fB)\fR, and \fB\e\fR in the \fIpattern_list\fR because they are also
  52   52  meaningful to the shell. It is safest to enclose the entire \fIpattern_list\fR
  53      -in single quotes \fBa\'\fR\&...\fBa\'\fR\&.
       53 +in single quotes \fB\'\fR\&...\fB\'\fR\&.
  54   54  .sp
  55   55  .LP
  56   56  If no files are specified, \fBgrep\fR assumes standard input. Normally, each
  57   57  line found is copied to standard output. The file name is printed before each
  58   58  line found if there is more than one input file.
  59   59  .SS "/usr/bin/grep"
  60   60  .sp
  61   61  .LP
  62   62  The \fB/usr/bin/grep\fR utility uses limited regular expressions like those
  63   63  described on the \fBregexp\fR(5) manual page to match the patterns.
↓ open down ↓ 136 lines elided ↑ open up ↑
 200  200  Searches for the expression as a word as if surrounded by \fB\e<\fR and
 201  201  \fB\e>\fR\&.
 202  202  .RE
 203  203  
 204  204  .SS "/usr/xpg4/bin/grep"
 205  205  .sp
 206  206  .LP
 207  207  The following options are supported for \fB/usr/xpg4/bin/grep\fR only:
 208  208  .sp
 209  209  .ne 2
      210 +.na
      211 +\fB\fB-A\fR \fInumber\fR\fR
      212 +.ad
      213 +.RS 19n
      214 +Prints \fInumber\fR input lines of context after each matching line. If there
      215 +are multiple matching lines, their context lines are separated by a \fB--\fR
      216 +delimiter line.
      217 +.RE
      218 +
      219 +.sp
      220 +.ne 2
      221 +.na
      222 +\fB\fB-B\fR \fInumber\fR\fR
      223 +.ad
      224 +.RS 19n
      225 +Prints \fInumber\fR input lines of context before each matching line. If there
      226 +are multiple matching lines, their context lines are separated by a \fB--\fR
      227 +delimiter line.
      228 +.RE
      229 +
      230 +.sp
      231 +.ne 2
      232 +.na
      233 +\fB\fB-\fR\fInumber\fR\fR
      234 +.ad
      235 +.br
      236 +.na
      237 +\fB\fB-C\fR \fInumber\fR\fR
      238 +.ad
      239 +.RS 19n
      240 +Prints \fInumber\fR input lines of context before and \fInumber\fR input lines
      241 +of context after each matching line. If there are multiple matching lines,
      242 +their context lines are separated by a \fB--\fR delimiter line.
      243 +.RE
      244 +
      245 +
      246 +.sp
      247 +.ne 2
 210  248  .na
 211  249  \fB\fB-e\fR \fIpattern_list\fR\fR
 212  250  .ad
 213  251  .RS 19n
 214  252  Specifies one or more patterns to be used during the search for input. Patterns
 215  253  in \fIpattern_list\fR must be separated by a NEWLINE character. A null pattern
 216  254  can be specified by two adjacent newline characters in \fIpattern_list\fR.
 217  255  Unless the \fB-E\fR or \fB-F\fR option is also specified, each pattern is
 218  256  treated as a basic regular expression.  Multiple \fB-e\fR and \fB-f\fR options
 219  257  are accepted by \fBgrep\fR. All of the specified patterns are used when
↓ open down ↓ 319 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX