Print this page
3737 grep does not support -H option
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/egrep.1
+++ new/usr/src/man/man1/egrep.1
1 1 '\" te
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
2 2 .\" Copyright 1989 AT&T
3 3 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
4 4 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
5 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 6 .\" http://www.opengroup.org/bookstore/.
7 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 8 .\" This notice shall appear on any product containing this material.
9 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 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 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 "Mar 24, 2006"
12 +.TH EGREP 1 "May 3, 2013"
13 13 .SH NAME
14 14 egrep \- search a file for a pattern using full regular expressions
15 15 .SH SYNOPSIS
16 16 .LP
17 17 .nf
18 -\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
18 +\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
19 19 .fi
20 20
21 21 .LP
22 22 .nf
23 -\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
23 +\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
24 24 .fi
25 25
26 26 .LP
27 27 .nf
28 -\fB/usr/bin/egrep\fR [\fB-bchilnsv\fR] \fIpattern\fR [\fIfile...\fR]
28 +\fB/usr/bin/egrep\fR [\fB-bcHhilnqsv\fR] \fIpattern\fR [\fIfile...\fR]
29 29 .fi
30 30
31 31 .LP
32 32 .nf
33 -\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
33 +\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
34 34 [\fIfile...\fR]
35 35 .fi
36 36
37 37 .LP
38 38 .nf
39 -\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
39 +\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
40 40 [\fIfile...\fR]
41 41 .fi
42 42
43 43 .LP
44 44 .nf
45 -\fB/usr/xpg4/bin/egrep\fR [\fB-bchilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
45 +\fB/usr/xpg4/bin/egrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
46 46 .fi
47 47
48 48 .SH DESCRIPTION
49 49 .sp
50 50 .LP
51 51 The \fBegrep\fR (\fIexpression grep\fR) utility searches files for a pattern of
52 52 characters and prints all lines that contain that pattern. \fBegrep\fR uses
53 53 full regular expressions (expressions that have string values that use the full
54 54 set of alphanumeric and special characters) to match the patterns. It uses a
55 55 fast deterministic algorithm that sometimes needs exponential space.
56 56 .sp
57 57 .LP
58 58 If no files are specified, \fBegrep\fR assumes standard input. Normally, each
59 59 line found is copied to the standard output. The file name is printed before
60 60 each line found if there is more than one input file.
61 61 .SS "/usr/bin/egrep"
62 62 .sp
63 63 .LP
64 64 The \fB/usr/bin/egrep\fR utility accepts full regular expressions as described
65 65 on the \fBregexp\fR(5) manual page, except for \fB\e(\fR and \fB\e)\fR,
66 66 \fB\e(\fR and \fB\e)\fR, \fB\e{\fR and \fB\e}\fR, \fB\e<\fR and \fB\e>\fR, and
67 67 \fB\en\fR, and with the addition of:
68 68 .RS +4
69 69 .TP
70 70 1.
71 71 A full regular expression followed by \fB+\fR that matches one or more
72 72 occurrences of the full regular expression.
73 73 .RE
74 74 .RS +4
75 75 .TP
76 76 2.
77 77 A full regular expression followed by \fB?\fR that matches 0 or 1
78 78 occurrences of the full regular expression.
79 79 .RE
80 80 .RS +4
81 81 .TP
82 82 3.
83 83 Full regular expressions separated by | or by a \fBNEWLINE\fR that match
84 84 strings that are matched by any of the expressions.
85 85 .RE
86 86 .RS +4
87 87 .TP
88 88 4.
89 89 A full regular expression that can be enclosed in parentheses \fB()\fRfor
90 90 grouping.
91 91 .RE
92 92 .sp
93 93 .LP
94 94 Be careful using the characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR,
95 95 \fB)\fR, and \fB\e\fR in \fIfull regular expression\fR, because they are also
96 96 meaningful to the shell. It is safest to enclose the entire \fIfull regular
97 97 expression\fR in single quotes (\fBa\'\fR\fBa\'\fR).
98 98 .sp
99 99 .LP
100 100 The order of precedence of operators is \fB[\|]\fR, then \fB*\|?\|+\fR, then
101 101 concatenation, then | and NEWLINE.
102 102 .SS "/usr/xpg4/bin/egrep"
103 103 .sp
104 104 .LP
105 105 The \fB/usr/xpg4/bin/egrep\fR utility uses the regular expressions described in
106 106 the \fBEXTENDED REGULAR EXPRESSIONS\fR section of the \fBregex\fR(5) manual
107 107 page.
108 108 .SH OPTIONS
109 109 .sp
110 110 .LP
111 111 The following options are supported for both \fB/usr/bin/egrep\fR and
112 112 \fB/usr/xpg4/bin/egrep\fR:
113 113 .sp
114 114 .ne 2
115 115 .na
116 116 \fB\fB-b\fR\fR
117 117 .ad
118 118 .RS 19n
119 119 Precede each line by the block number on which it was found. This can be useful
120 120 in locating block numbers by context (first block is 0).
121 121 .RE
122 122
123 123 .sp
124 124 .ne 2
125 125 .na
126 126 \fB\fB-c\fR\fR
127 127 .ad
128 128 .RS 19n
129 129 Print only a count of the lines that contain the pattern.
130 130 .RE
131 131
132 132 .sp
133 133 .ne 2
134 134 .na
135 135 \fB\fB-e\fR \fIpattern_list\fR\fR
136 136 .ad
137 137 .RS 19n
138 138 Search for a \fIpattern_list\fR (\fIfull regular expression\fR that begins with
139 139 a \fB\(mi\fR).
140 140 .RE
141 141
142 142 .sp
143 143 .ne 2
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
144 144 .na
145 145 \fB\fB-f\fR \fIfile\fR\fR
146 146 .ad
147 147 .RS 19n
148 148 Take the list of \fIfull\fR \fIregular\fR \fIexpressions\fR from \fIfile\fR.
149 149 .RE
150 150
151 151 .sp
152 152 .ne 2
153 153 .na
154 +\fB\fB-H\fR\fR
155 +.ad
156 +.RS 19n
157 +Precedes each line by the name of the file containing the matching line.
158 +.RE
159 +
160 +.sp
161 +.ne 2
162 +.na
154 163 \fB\fB-h\fR\fR
155 164 .ad
156 165 .RS 19n
157 166 Suppress printing of filenames when searching multiple files.
158 167 .RE
159 168
160 169 .sp
161 170 .ne 2
162 171 .na
163 172 \fB\fB-i\fR\fR
164 173 .ad
165 174 .RS 19n
166 175 Ignore upper/lower case distinction during comparisons.
167 176 .RE
168 177
169 178 .sp
170 179 .ne 2
171 180 .na
172 181 \fB\fB-l\fR\fR
173 182 .ad
174 183 .RS 19n
175 184 Print the names of files with matching lines once, separated by NEWLINEs. Does
176 185 not repeat the names of files when the pattern is found more than once.
177 186 .RE
178 187
179 188 .sp
180 189 .ne 2
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
181 190 .na
182 191 \fB\fB-n\fR\fR
183 192 .ad
184 193 .RS 19n
185 194 Precede each line by its line number in the file (first line is 1).
186 195 .RE
187 196
188 197 .sp
189 198 .ne 2
190 199 .na
200 +\fB\fB-q\fR\fR
201 +.ad
202 +.RS 19n
203 +Quiet. Does not write anything to the standard output, regardless of matching
204 +lines. Exits with zero status if an input line is selected.
205 +.RE
206 +
207 +.sp
208 +.ne 2
209 +.na
191 210 \fB\fB-s\fR\fR
192 211 .ad
193 212 .RS 19n
194 -Work silently, that is, display nothing except error messages. This is useful
195 -for checking the error status.
213 +Legacy equivalent of \fB-q\fR.
196 214 .RE
197 215
198 216 .sp
199 217 .ne 2
200 218 .na
201 219 \fB\fB-v\fR\fR
202 220 .ad
203 221 .RS 19n
204 222 Print all lines except those that contain the pattern.
205 223 .RE
206 224
207 225 .SS "/usr/xpg4/bin/egrep"
208 226 .sp
209 227 .LP
210 228 The following options are supported for \fB/usr/xpg4/bin/egrep\fR only:
211 229 .sp
212 230 .ne 2
213 231 .na
214 -\fB\fB-q\fR\fR
215 -.ad
216 -.RS 6n
217 -Quiet. Does not write anything to the standard output, regardless of matching
218 -lines. Exits with zero status if an input line is selected.
219 -.RE
220 -
221 -.sp
222 -.ne 2
223 -.na
224 232 \fB\fB-x\fR\fR
225 233 .ad
226 234 .RS 6n
227 235 Consider only input lines that use all characters in the line to match an
228 236 entire fixed string or regular expression to be matching lines.
229 237 .RE
230 238
231 239 .SH OPERANDS
232 240 .sp
233 241 .LP
234 242 The following operands are supported:
235 243 .sp
236 244 .ne 2
237 245 .na
238 246 \fB\fIfile\fR\fR
239 247 .ad
240 248 .RS 8n
241 249 A path name of a file to be searched for the patterns. If no \fIfile\fR
242 250 operands are specified, the standard input is used.
243 251 .RE
244 252
245 253 .SS "/usr/bin/egrep"
246 254 .sp
247 255 .ne 2
248 256 .na
249 257 \fB\fIpattern\fR\fR
250 258 .ad
251 259 .RS 11n
252 260 Specify a pattern to be used during the search for input.
253 261 .RE
254 262
255 263 .SS "/usr/xpg4/bin/egrep"
256 264 .sp
257 265 .ne 2
258 266 .na
259 267 \fB\fIpattern\fR\fR
260 268 .ad
261 269 .RS 11n
262 270 Specify one or more patterns to be used during the search for input. This
263 271 operand is treated as if it were specified as \fB-e\fR\fIpattern_list.\fR.
264 272 .RE
265 273
266 274 .SH USAGE
267 275 .sp
268 276 .LP
269 277 See \fBlargefile\fR(5) for the description of the behavior of \fBegrep\fR when
270 278 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
271 279 .SH ENVIRONMENT VARIABLES
272 280 .sp
273 281 .LP
274 282 See \fBenviron\fR(5) for descriptions of the following environment variables
275 283 that affect the execution of \fBegrep\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR,
276 284 \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
277 285 .SH EXIT STATUS
278 286 .sp
279 287 .LP
280 288 The following exit values are returned:
281 289 .sp
282 290 .ne 2
283 291 .na
284 292 \fB\fB0\fR\fR
285 293 .ad
286 294 .RS 5n
287 295 If any matches are found.
288 296 .RE
289 297
290 298 .sp
291 299 .ne 2
292 300 .na
293 301 \fB\fB1\fR\fR
294 302 .ad
295 303 .RS 5n
296 304 If no matches are found.
297 305 .RE
298 306
299 307 .sp
300 308 .ne 2
301 309 .na
302 310 \fB\fB2\fR\fR
303 311 .ad
304 312 .RS 5n
305 313 For syntax errors or inaccessible files (even if matches were found).
306 314 .RE
307 315
308 316 .SH ATTRIBUTES
309 317 .sp
310 318 .LP
311 319 See \fBattributes\fR(5) for descriptions of the following attributes:
312 320 .SS "/usr/bin/egrep"
313 321 .sp
314 322
315 323 .sp
316 324 .TS
317 325 box;
318 326 c | c
319 327 l | l .
320 328 ATTRIBUTE TYPE ATTRIBUTE VALUE
321 329 _
322 330 CSI Not Enabled
323 331 .TE
324 332
325 333 .SS "/usr/xpg4/bin/egrep"
326 334 .sp
327 335
328 336 .sp
329 337 .TS
330 338 box;
331 339 c | c
332 340 l | l .
333 341 ATTRIBUTE TYPE ATTRIBUTE VALUE
334 342 _
335 343 CSI Enabled
336 344 .TE
337 345
338 346 .SH SEE ALSO
339 347 .sp
340 348 .LP
341 349 \fBfgrep\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1), \fBattributes\fR(5),
342 350 \fBenviron\fR(5), \fBlargefile\fR(5), \fBregex\fR(5), \fBregexp\fR(5),
343 351 \fBXPG4\fR(5)
344 352 .SH NOTES
345 353 .sp
346 354 .LP
347 355 Ideally there should be only one \fBgrep\fR command, but there is not a single
348 356 algorithm that spans a wide enough range of space-time trade-offs.
349 357 .sp
350 358 .LP
351 359 Lines are limited only by the size of the available virtual memory.
352 360 .SS "/usr/xpg4/bin/egrep"
353 361 .sp
354 362 .LP
355 363 The \fB/usr/xpg4/bin/egrep\fR utility is identical to \fB/usr/xpg4/bin/grep\fR
356 364 \fB-E\fR. See \fBgrep\fR(1). Portable applications should use
357 365 \fB/usr/xpg4/bin/grep\fR \fB-E\fR.
↓ open down ↓ |
124 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX