9087 9001 forgot to remove THIRDPARTYLICENSE
[unleashed.git] / usr / src / man / man1 / egrep.1
blobb3d8d2ca96a0994076d40100e495b55b9fd54291
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 .\" 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
6 .\" http://www.opengroup.org/bookstore/.
7 .\" 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.
8 .\"  This notice shall appear on any product containing this material.
9 .\" 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.
10 .\" 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.
11 .\" 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]
12 .TH EGREP 1 "Nov 28, 2017"
13 .SH NAME
14 egrep \- search a file for a pattern using full regular expressions
15 .SH SYNOPSIS
16 .LP
17 .nf
18 \fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
19      [\fIfile...\fR]
20 .fi
22 .LP
23 .nf
24 \fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
25      [\fIfile...\fR]
26 .fi
28 .LP
29 .nf
30 \fB/usr/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
31 .fi
33 .SH DESCRIPTION
34 .LP
35 The \fBegrep\fR (\fIexpression grep\fR) utility searches files for a pattern of
36 characters and prints all lines that contain that pattern. \fBegrep\fR uses
37 full regular expressions (expressions that have string values that use the full
38 set of alphanumeric and special characters) to match the patterns. It uses a
39 fast deterministic algorithm that sometimes needs exponential space.
40 .sp
41 .LP
42 If no files are specified, \fBegrep\fR assumes standard input. Normally, each
43 line found is copied to the standard output. The file name is printed before
44 each line found if there is more than one input file.
45 .LP
46 The \fBegrep\fR utility accepts the same form of full regular expressions as
47 \fBgrep\fR(1) -E option.
48 .sp
49 .LP
50 Be careful using the characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR,
51 \fB)\fR, and \fB\e\fR in \fIfull regular expression\fR, because they are also
52 meaningful to the shell. It is safest to enclose the entire \fIfull regular
53 expression\fR in single quotes (\fBa\'\fR\fBa\'\fR).
54 .sp
55 .LP
56 The order of precedence of operators is \fB[\|]\fR, then \fB*\|?\|+\fR, then
57 concatenation, then | and NEWLINE.
58 .SH OPTIONS
59 .LP
60 The following options are supported:
61 .sp
62 .ne 2
63 .na
64 \fB\fB-b\fR\fR
65 .ad
66 .RS 6n
67 Precede each line by the block number on which it was found. This can be useful
68 in locating block numbers by context (first block is 0).
69 .RE
71 .sp
72 .ne 2
73 .na
74 \fB\fB-c\fR\fR
75 .ad
76 .RS 6n
77 Print only a count of the lines that contain the pattern.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fB-e\fR \fIpattern_list\fR\fR
84 .ad
85 .RS 6n
86 Search for a \fIpattern_list\fR (\fIfull regular expression\fR that begins with
87 a \fB\(mi\fR).
88 .RE
90 .sp
91 .ne 2
92 .na
93 \fB\fB-f\fR \fIfile\fR\fR
94 .ad
95 .RS 6n
96 Take the list of \fIfull\fR \fIregular\fR \fIexpressions\fR from \fIfile\fR.
97 .RE
99 .sp
100 .ne 2
102 \fB\fB-H\fR\fR
104 .RS 6n
105 Precedes each line by the name of the file containing the matching line.
109 .ne 2
111 \fB\fB-h\fR\fR
113 .RS 6n
114 Suppress printing of filenames when searching multiple files.
118 .ne 2
120 \fB\fB-i\fR\fR
122 .RS 6n
123 Ignore upper/lower case distinction during comparisons.
127 .ne 2
129 \fB\fB-l\fR\fR
131 .RS 6n
132 Print the names of files with matching lines once, separated by NEWLINEs. Does
133 not repeat the names of files when the pattern is found more than once.
137 .ne 2
139 \fB\fB-n\fR\fR
141 .RS 6n
142 Precede each line by its line number in the file (first line is 1).
146 .ne 2
148 \fB\fB-q\fR\fR
150 .RS 6n
151 Quiet. Does not write anything to the standard output, regardless of matching
152 lines. Exits with zero status if an input line is selected.
156 .ne 2
158 \fB\fB-s\fR\fR
160 .RS 6n
161 Legacy equivalent of \fB-q\fR.
165 .ne 2
167 \fB\fB-v\fR\fR
169 .RS 6n
170 Print all lines except those that contain the pattern.
174 .ne 2
176 \fB\fB-x\fR\fR
178 .RS 6n
179 Consider only input lines that use all characters in the line to match an
180 entire fixed string or regular expression to be matching lines.
183 .SH OPERANDS
185 The following operands are supported:
187 .ne 2
189 \fB\fIfile\fR\fR
191 .RS 8n
192 A path name of a file to be searched for the patterns. If no \fIfile\fR
193 operands are specified, the standard input is used.
196 .ne 2
198 \fB\fIpattern\fR\fR
200 .RS 8n
201 Specify one or more patterns to be used during the search for input. This
202 operand is treated as if it were specified as \fB-e\fR\fIpattern_list\fR.
205 .SH USAGE
207 See \fBlargefile\fR(5) for the description of the behavior of \fBegrep\fR when
208 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
209 .SH ENVIRONMENT VARIABLES
211 See \fBenviron\fR(5) for descriptions of the following environment variables
212 that affect the execution of \fBegrep\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR,
213 \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
214 .SH EXIT STATUS
216 The following exit values are returned:
218 .ne 2
220 \fB\fB0\fR\fR
222 .RS 5n
223 If any matches are found.
227 .ne 2
229 \fB\fB1\fR\fR
231 .RS 5n
232 If no matches are found.
236 .ne 2
238 \fB\fB2\fR\fR
240 .RS 5n
241 For syntax errors or inaccessible files (even if matches were found).
244 .SH ATTRIBUTES
246 See \fBattributes\fR(5) for descriptions of the following attributes:
250 box;
251 c | c
252 l | l .
253 ATTRIBUTE TYPE  ATTRIBUTE VALUE
255 CSI     Enabled
258 .SH SEE ALSO
260 \fBfgrep\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1), \fBattributes\fR(5),
261 \fBenviron\fR(5), \fBlargefile\fR(5), \fBregex\fR(5), \fBregexp\fR(5),
262 \fBXPG4\fR(5)
263 .SH NOTES
265 Ideally there should be only one \fBgrep\fR command, but there is not a single
266 algorithm that spans a wide enough range of space-time trade-offs.
269 Lines are limited only by the size of the available virtual memory.
271 The \fB/usr/bin/egrep\fR utility is identical to \fB/usr/bin/grep\fR
272 \fB-E\fR. See \fBgrep\fR(1). Portable applications should use
273 \fB/usr/bin/grep\fR \fB-E\fR.
275 In the past the behavior of \fB/usr/xpg4/bin/egrep\fR and
276 \fB/usr/bin/egrep\fR utilities was different. Now \fB/usr/bin/egrep\fR
277 is replaced by \fB/usr/xpg4/bin/egrep\fR.