Print this page
3737 grep does not support -H option
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/fgrep.1
+++ new/usr/src/man/man1/fgrep.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 FGREP 1 "Mar 24, 2006"
12 +.TH FGREP 1 "May 3, 2013"
13 13 .SH NAME
14 14 fgrep \- search a file for a fixed-character string
15 15 .SH SYNOPSIS
16 16 .LP
17 17 .nf
18 -\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
18 +\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
19 19 .fi
20 20
21 21 .LP
22 22 .nf
23 -\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
23 +\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
24 24 .fi
25 25
26 26 .LP
27 27 .nf
28 -\fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fIpattern\fR [\fIfile...\fR]
28 +\fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
29 29 .fi
30 30
31 31 .LP
32 32 .nf
33 -\fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
33 +\fB/usr/xpg4/bin/fgrep\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/fgrep\fR [\fB-bchilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
39 +\fB/usr/xpg4/bin/fgrep\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/fgrep\fR [\fB-bchilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
45 +\fB/usr/xpg4/bin/fgrep\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 \fBfgrep\fR (fast \fBgrep\fR) utility searches files for a character string
52 52 and prints all lines that contain that string. \fBfgrep\fR is different from
53 53 \fBgrep\fR(1) and from \fBegrep\fR(1) because it searches for a string, instead
54 54 of searching for a pattern that matches an expression. \fBfgrep\fR uses a fast
55 55 and compact algorithm.
56 56 .sp
57 57 .LP
58 58 The characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR, \fB)\fR, and
59 59 \fB\e\fR are interpreted literally by \fBfgrep\fR, that is, \fBfgrep\fR does
60 60 not recognize full regular expressions as does \fBegrep\fR. These characters
61 61 have special meaning to the shell. Therefore, to be safe, enclose the entire
62 62 \fIstring\fR within single quotes (\fBa\'\fR).
63 63 .sp
64 64 .LP
65 65 If no files are specified, \fBfgrep\fR assumes standard input. Normally, each
66 66 line that is found is copied to the standard output. The file name is printed
67 67 before each line that is found if there is more than one input file.
68 68 .SH OPTIONS
69 69 .sp
70 70 .LP
71 71 The following options are supported for both \fB/usr/bin/fgrep\fR and
72 72 \fB/usr/xpg4/bin/fgrep\fR:
73 73 .sp
74 74 .ne 2
75 75 .na
76 76 \fB\fB-b\fR\fR
77 77 .ad
78 78 .RS 19n
79 79 Precedes each line by the block number on which the line was found. This can be
80 80 useful in locating block numbers by context. The first block is 0.
81 81 .RE
82 82
83 83 .sp
84 84 .ne 2
85 85 .na
86 86 \fB\fB-c\fR\fR
87 87 .ad
88 88 .RS 19n
89 89 Prints only a count of the lines that contain the pattern.
90 90 .RE
91 91
92 92 .sp
93 93 .ne 2
94 94 .na
95 95 \fB\fB-e\fR \fIpattern_list\fR\fR
96 96 .ad
97 97 .RS 19n
98 98 Searches for a \fIstring\fR in \fIpattern-list\fR. This is useful when the
99 99 \fIstring\fR begins with a \fB\(mi\fR\&.
100 100 .RE
101 101
102 102 .sp
103 103 .ne 2
↓ open down ↓ |
48 lines elided |
↑ open up ↑ |
104 104 .na
105 105 \fB\fB-f\fR \fIpattern-file\fR\fR
106 106 .ad
107 107 .RS 19n
108 108 Takes the list of patterns from \fIpattern-file\fR.
109 109 .RE
110 110
111 111 .sp
112 112 .ne 2
113 113 .na
114 +\fB\fB-H\fR\fR
115 +.ad
116 +.RS 19n
117 +Precedes each line by the name of the file containing the matching line.
118 +.RE
119 +
120 +.sp
121 +.ne 2
122 +.na
114 123 \fB\fB-h\fR\fR
115 124 .ad
116 125 .RS 19n
117 126 Suppresses printing of files when searching multiple files.
118 127 .RE
119 128
120 129 .sp
121 130 .ne 2
122 131 .na
123 132 \fB\fB-i\fR\fR
124 133 .ad
125 134 .RS 19n
126 135 Ignores upper/lower case distinction during comparisons.
127 136 .RE
128 137
129 138 .sp
130 139 .ne 2
131 140 .na
132 141 \fB\fB-l\fR\fR
133 142 .ad
134 143 .RS 19n
135 144 Prints the names of files with matching lines once, separated by new-lines.
136 145 Does not repeat the names of files when the pattern is found more than once.
137 146 .RE
138 147
139 148 .sp
140 149 .ne 2
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
141 150 .na
142 151 \fB\fB-n\fR\fR
143 152 .ad
144 153 .RS 19n
145 154 Precedes each line by its line number in the file. The first line is 1.
146 155 .RE
147 156
148 157 .sp
149 158 .ne 2
150 159 .na
151 -\fB\fB-s\fR\fR
160 +\fB\fB-q\fR\fR
152 161 .ad
153 162 .RS 19n
154 -Works silently, that is, displays nothing except error messages. This is useful
155 -for checking the error status.
163 +Quiet. Does not write anything to the standard output, regardless of matching
164 +lines. Exits with zero status if an input line is selected.
156 165 .RE
157 166
158 167 .sp
159 168 .ne 2
160 169 .na
161 -\fB\fB-v\fR\fR
170 +\fB\fB-s\fR\fR
162 171 .ad
163 172 .RS 19n
164 -Prints all lines except those that contain the pattern.
173 +Legacy equivalent of \fB-q\fR.
165 174 .RE
166 175
167 176 .sp
168 177 .ne 2
169 178 .na
170 -\fB\fB-x\fR\fR
179 +\fB\fB-v\fR\fR
171 180 .ad
172 181 .RS 19n
173 -Prints only lines that are matched entirely.
182 +Prints all lines except those that contain the pattern.
174 183 .RE
175 184
176 -.SS "/usr/xpg4/bin/fgrep"
177 185 .sp
178 -.LP
179 -The following options are supported for \fB/usr/xpg4/bin/fgrep\fR only:
180 -.sp
181 186 .ne 2
182 187 .na
183 -\fB\fB-q\fR\fR
188 +\fB\fB-x\fR\fR
184 189 .ad
185 -.RS 6n
186 -Quiet. Does not write anything to the standard output, regardless of matching
187 -lines. Exits with zero status if an input line is selected.
190 +.RS 19n
191 +Prints only lines that are matched entirely.
188 192 .RE
189 193
190 194 .SH OPERANDS
191 195 .sp
192 196 .LP
193 197 The following operands are supported:
194 198 .sp
195 199 .ne 2
196 200 .na
197 201 \fB\fIfile\fR\fR
198 202 .ad
199 203 .RS 8n
200 204 Specifies a path name of a file to be searched for the patterns. If no
201 205 \fIfile\fR operands are specified, the standard input will be used.
202 206 .RE
203 207
204 208 .SS "/usr/bin/fgrep"
205 209 .sp
206 210 .ne 2
207 211 .na
208 212 \fB\fIpattern\fR\fR
209 213 .ad
210 214 .RS 11n
211 215 Specifies a pattern to be used during the search for input.
212 216 .RE
213 217
214 218 .SS "/usr/xpg4/bin/fgrep"
215 219 .sp
216 220 .ne 2
217 221 .na
218 222 \fB\fIpattern\fR\fR
219 223 .ad
220 224 .RS 11n
221 225 Specifies one or more patterns to be used during the search for input. This
222 226 operand is treated as if it were specified as \fB-e\fR \fIpattern_list\fR.
223 227 .RE
224 228
225 229 .SH USAGE
226 230 .sp
227 231 .LP
228 232 See \fBlargefile\fR(5) for the description of the behavior of \fBfgrep\fR when
229 233 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
230 234 .SH ENVIRONMENT VARIABLES
231 235 .sp
232 236 .LP
233 237 See \fBenviron\fR(5) for descriptions of the following environment variables
234 238 that affect the execution of \fBfgrep\fR: \fBLC_COLLATE\fR, \fBLC_CTYPE\fR,
235 239 \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
236 240 .SH EXIT STATUS
237 241 .sp
238 242 .LP
239 243 The following exit values are returned:
240 244 .sp
241 245 .ne 2
242 246 .na
243 247 \fB\fB0\fR\fR
244 248 .ad
245 249 .RS 5n
246 250 If any matches are found
247 251 .RE
248 252
249 253 .sp
250 254 .ne 2
251 255 .na
252 256 \fB\fB1\fR\fR
253 257 .ad
254 258 .RS 5n
255 259 If no matches are found
256 260 .RE
257 261
258 262 .sp
259 263 .ne 2
260 264 .na
261 265 \fB\fB2\fR\fR
262 266 .ad
263 267 .RS 5n
264 268 For syntax errors or inaccessible files, even if matches were found.
265 269 .RE
266 270
267 271 .SS "/usr/xpg4/bin/fgrep"
268 272 .sp
269 273
270 274 .SH ATTRIBUTES
271 275 .sp
272 276 .LP
273 277 See \fBattributes\fR(5) for descriptions of the following attributes:
274 278 .sp
275 279 .TS
276 280 box;
277 281 c | c
278 282 l | l .
279 283 ATTRIBUTE TYPE ATTRIBUTE VALUE
280 284 _
281 285 CSI Enabled
282 286 .TE
283 287
284 288 .SH SEE ALSO
285 289 .sp
286 290 .LP
287 291 \fBed\fR(1), \fBegrep\fR(1), \fBgrep\fR(1), \fBsed\fR(1), \fBsh\fR(1),
288 292 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBXPG4\fR(5)
289 293 .SH NOTES
290 294 .sp
291 295 .LP
292 296 Ideally, there should be only one \fBgrep\fR command, but there is not a single
293 297 algorithm that spans a wide enough range of space-time tradeoffs.
294 298 .sp
295 299 .LP
296 300 Lines are limited only by the size of the available virtual memory.
297 301 .SS "/usr/xpg4/bin/fgrep"
298 302 .sp
299 303 .LP
300 304 The \fB/usr/xpg4/bin/fgrep\fR utility is identical to \fB/usr/xpg4/bin/grep\fR
301 305 \fB-F\fR (see \fBgrep\fR(1)). Portable applications should use
302 306 \fB/usr/xpg4/bin/grep\fR \fB-F\fR.
↓ open down ↓ |
105 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX