Print this page
3546 add support for grep -o option

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/grep.1
          +++ new/usr/src/man/man1/grep.1
   1    1  '\" te
        2 +.\" Copyright (c) 2013 Andrew Stormont.  All rights reserved.
   2    3  .\" Copyright 2012 Nexenta Systems, Inc. All rights reserved.
   3    4  .\" Copyright 1989 AT&T
   4    5  .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
   5    6  .\" Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
   6    7  .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   7    8  .\" http://www.opengroup.org/bookstore/.
   8    9  .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   9   10  .\"  This notice shall appear on any product containing this material.
  10   11  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
  11   12  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  12   13  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  13   14  .TH GREP 1 "May 3, 2013"
  14   15  .SH NAME
  15   16  grep \- search a file for a pattern
  16   17  .SH SYNOPSIS
  17   18  .LP
  18   19  .nf
  19      -\fB/usr/bin/grep\fR [\fB-c\fR | \fB-l\fR |\fB-q\fR] [\fB-r\fR | \fB-R\fR] [\fB-bHhinsvw\fR]
       20 +\fB/usr/bin/grep\fR [\fB-c\fR | \fB-l\fR | \fB-q\fR | \fB-o\fR] [\fB-r\fR | \fB-R\fR] [\fB-bHhinsvw\fR]
  20   21      \fIlimited-regular-expression\fR [\fIfilename\fR]...
  21   22  .fi
  22   23  
  23   24  .LP
  24   25  .nf
  25      -\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
       26 +\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR | \fB-o\fR] [\fB-r\fR | \fB-R\fR]
  26   27      [\fB-bHhinsvwx\fR] \fB-e\fR \fIpattern_list\fR... [\fB-f\fR \fIpattern_file\fR]...
  27   28      [\fIfile\fR]...
  28   29  .fi
  29   30  
  30   31  .LP
  31   32  .nf
  32      -\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
       33 +\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR | \fB-o\fR] [\fB-r\fR | \fB-R\fR]
  33   34      [\fB-bHhinsvwx\fR] [\fB-e\fR \fIpattern_list\fR]... \fB-f\fR \fIpattern_file\fR...
  34   35      [\fIfile\fR]...
  35   36  .fi
  36   37  
  37   38  .LP
  38   39  .nf
  39      -\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR] [\fB-r\fR | \fB-R\fR]
       40 +\fB/usr/xpg4/bin/grep\fR [\fB-E\fR | \fB-F\fR] [\fB-c\fR | \fB-l\fR | \fB-q\fR | \fB-o\fR] [\fB-r\fR | \fB-R\fR]
  40   41      [\fB-bHhinsvwx\fR] \fIpattern\fR [\fIfile\fR]...
  41   42  .fi
  42   43  
  43   44  .SH DESCRIPTION
  44   45  .sp
  45   46  .LP
  46   47  The \fBgrep\fR utility searches text files for a pattern and prints all lines
  47   48  that contain that pattern.  It uses a compact non-deterministic algorithm.
  48   49  .sp
  49   50  .LP
↓ open down ↓ 89 lines elided ↑ open up ↑
 139  140  .na
 140  141  \fB\fB-n\fR\fR
 141  142  .ad
 142  143  .RS 6n
 143  144  Precedes each line by its line number in the file (first line is 1).
 144  145  .RE
 145  146  
 146  147  .sp
 147  148  .ne 2
 148  149  .na
      150 +\fB\fB-o\fR\fR
      151 +.ad
      152 +.RS 6n
      153 +Print only the matching part of the line.
      154 +.RE
      155 +
      156 +.sp
      157 +.ne 2
      158 +.na
 149  159  \fB\fB-r\fR\fR
 150  160  .ad
 151  161  .RS 6n
 152  162  Read all files under each directory, recursively. Follow symbolic links on
 153  163  the command line, but skip symlinks that are encountered recursively. If file
 154  164  is a device, FIFO, or socket, skip it.
 155  165  .RE
 156  166  
 157  167  .sp
 158  168  .ne 2
↓ open down ↓ 380 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX