Print this page
3546 add support for grep -o option
@@ -1,6 +1,7 @@
'\" te
+.\" Copyright (c) 2013 Andrew Stormont. All rights reserved.
.\" Copyright 2012 Nexenta Systems, Inc. All rights reserved.
.\" Copyright 1989 AT&T
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
.\" 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
@@ -14,31 +15,31 @@
.SH NAME
grep \- search a file for a pattern
.SH SYNOPSIS
.LP
.nf
-\fB/usr/bin/grep\fR [\fB-c\fR | \fB-l\fR |\fB-q\fR] [\fB-r\fR | \fB-R\fR] [\fB-bHhinsvw\fR]
+\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]
\fIlimited-regular-expression\fR [\fIfilename\fR]...
.fi
.LP
.nf
-\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]
+\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]
[\fB-bHhinsvwx\fR] \fB-e\fR \fIpattern_list\fR... [\fB-f\fR \fIpattern_file\fR]...
[\fIfile\fR]...
.fi
.LP
.nf
-\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]
+\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]
[\fB-bHhinsvwx\fR] [\fB-e\fR \fIpattern_list\fR]... \fB-f\fR \fIpattern_file\fR...
[\fIfile\fR]...
.fi
.LP
.nf
-\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]
+\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]
[\fB-bHhinsvwx\fR] \fIpattern\fR [\fIfile\fR]...
.fi
.SH DESCRIPTION
.sp
@@ -144,10 +145,19 @@
.RE
.sp
.ne 2
.na
+\fB\fB-o\fR\fR
+.ad
+.RS 6n
+Print only the matching part of the line.
+.RE
+
+.sp
+.ne 2
+.na
\fB\fB-r\fR\fR
.ad
.RS 6n
Read all files under each directory, recursively. Follow symbolic links on
the command line, but skip symlinks that are encountered recursively. If file