Print this page
3737 grep does not support -H option
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
   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 FGREP 1 "Mar 24, 2006"
  13 .SH NAME
  14 fgrep \- search a file for a fixed-character string
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  18 \fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
  19 .fi
  20 
  21 .LP
  22 .nf
  23 \fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
  24 .fi
  25 
  26 .LP
  27 .nf
  28 \fB/usr/bin/fgrep\fR [\fB-bchilnsvx\fR] \fIpattern\fR [\fIfile...\fR]
  29 .fi
  30 
  31 .LP
  32 .nf
  33 \fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
  34      [\fIfile...\fR]
  35 .fi
  36 
  37 .LP
  38 .nf
  39 \fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
  40      [\fIfile...\fR]
  41 .fi
  42 
  43 .LP
  44 .nf
  45 \fB/usr/xpg4/bin/fgrep\fR [\fB-bchilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
  46 .fi
  47 
  48 .SH DESCRIPTION
  49 .sp
  50 .LP
  51 The \fBfgrep\fR (fast \fBgrep\fR) utility searches files for a character string
  52 and prints all lines that contain that string. \fBfgrep\fR is different from
  53 \fBgrep\fR(1) and from \fBegrep\fR(1) because it searches for a string, instead
  54 of searching for a pattern that matches an expression. \fBfgrep\fR uses a fast
  55 and compact algorithm.
  56 .sp
  57 .LP
  58 The characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR, \fB)\fR, and
  59 \fB\e\fR are interpreted literally by \fBfgrep\fR, that is, \fBfgrep\fR does
  60 not recognize full regular expressions as does \fBegrep\fR. These characters
  61 have special meaning to the shell. Therefore, to be safe, enclose the entire
  62 \fIstring\fR within single quotes (\fBa\'\fR).
  63 .sp
  64 .LP
  65 If no files are specified, \fBfgrep\fR assumes standard input. Normally, each


  94 .na
  95 \fB\fB-e\fR \fIpattern_list\fR\fR
  96 .ad
  97 .RS 19n
  98 Searches for a \fIstring\fR in \fIpattern-list\fR. This is useful when the
  99 \fIstring\fR begins with a \fB\(mi\fR\&.
 100 .RE
 101 
 102 .sp
 103 .ne 2
 104 .na
 105 \fB\fB-f\fR \fIpattern-file\fR\fR
 106 .ad
 107 .RS 19n
 108 Takes the list of patterns from \fIpattern-file\fR.
 109 .RE
 110 
 111 .sp
 112 .ne 2
 113 .na









 114 \fB\fB-h\fR\fR
 115 .ad
 116 .RS 19n
 117 Suppresses printing of files when searching multiple files.
 118 .RE
 119 
 120 .sp
 121 .ne 2
 122 .na
 123 \fB\fB-i\fR\fR
 124 .ad
 125 .RS 19n
 126 Ignores upper/lower case distinction during comparisons.
 127 .RE
 128 
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fB-l\fR\fR
 133 .ad
 134 .RS 19n
 135 Prints the names of files with matching lines once, separated by new-lines.
 136 Does not repeat the names of files when the pattern is found more than once.
 137 .RE
 138 
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fB-n\fR\fR
 143 .ad
 144 .RS 19n
 145 Precedes each line by its line number in the file. The first line is 1.
 146 .RE
 147 
 148 .sp
 149 .ne 2
 150 .na
 151 \fB\fB-s\fR\fR
 152 .ad
 153 .RS 19n
 154 Works silently, that is, displays nothing except error messages. This is useful
 155 for checking the error status.
 156 .RE
 157 
 158 .sp
 159 .ne 2
 160 .na
 161 \fB\fB-v\fR\fR
 162 .ad
 163 .RS 19n
 164 Prints all lines except those that contain the pattern.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB\fB-x\fR\fR
 171 .ad
 172 .RS 19n
 173 Prints only lines that are matched entirely.
 174 .RE
 175 
 176 .SS "/usr/xpg4/bin/fgrep"
 177 .sp
 178 .LP
 179 The following options are supported for \fB/usr/xpg4/bin/fgrep\fR only:
 180 .sp
 181 .ne 2
 182 .na
 183 \fB\fB-q\fR\fR
 184 .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.
 188 .RE
 189 
 190 .SH OPERANDS
 191 .sp
 192 .LP
 193 The following operands are supported:
 194 .sp
 195 .ne 2
 196 .na
 197 \fB\fIfile\fR\fR
 198 .ad
 199 .RS 8n
 200 Specifies a path name of a file to be searched for the patterns. If no
 201 \fIfile\fR operands are specified, the standard input will be used.
 202 .RE
 203 
 204 .SS "/usr/bin/fgrep"
 205 .sp
 206 .ne 2
 207 .na


   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 FGREP 1 "May 3, 2013"
  13 .SH NAME
  14 fgrep \- search a file for a fixed-character string
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  18 \fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fIfile...\fR]
  19 .fi
  20 
  21 .LP
  22 .nf
  23 \fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-f\fR \fIfile\fR [\fIfile...\fR]
  24 .fi
  25 
  26 .LP
  27 .nf
  28 \fB/usr/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
  29 .fi
  30 
  31 .LP
  32 .nf
  33 \fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fB-e\fR \fIpattern_list\fR [\fB-f\fR \fIfile\fR]
  34      [\fIfile...\fR]
  35 .fi
  36 
  37 .LP
  38 .nf
  39 \fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] [\fB-e\fR \fIpattern_list\fR] \fB-f\fR \fIfile\fR
  40      [\fIfile...\fR]
  41 .fi
  42 
  43 .LP
  44 .nf
  45 \fB/usr/xpg4/bin/fgrep\fR [\fB-bcHhilnqsvx\fR] \fIpattern\fR [\fIfile...\fR]
  46 .fi
  47 
  48 .SH DESCRIPTION
  49 .sp
  50 .LP
  51 The \fBfgrep\fR (fast \fBgrep\fR) utility searches files for a character string
  52 and prints all lines that contain that string. \fBfgrep\fR is different from
  53 \fBgrep\fR(1) and from \fBegrep\fR(1) because it searches for a string, instead
  54 of searching for a pattern that matches an expression. \fBfgrep\fR uses a fast
  55 and compact algorithm.
  56 .sp
  57 .LP
  58 The characters \fB$\fR, \fB*\fR, \fB[\fR, \fB^\fR, |, \fB(\fR, \fB)\fR, and
  59 \fB\e\fR are interpreted literally by \fBfgrep\fR, that is, \fBfgrep\fR does
  60 not recognize full regular expressions as does \fBegrep\fR. These characters
  61 have special meaning to the shell. Therefore, to be safe, enclose the entire
  62 \fIstring\fR within single quotes (\fBa\'\fR).
  63 .sp
  64 .LP
  65 If no files are specified, \fBfgrep\fR assumes standard input. Normally, each


  94 .na
  95 \fB\fB-e\fR \fIpattern_list\fR\fR
  96 .ad
  97 .RS 19n
  98 Searches for a \fIstring\fR in \fIpattern-list\fR. This is useful when the
  99 \fIstring\fR begins with a \fB\(mi\fR\&.
 100 .RE
 101 
 102 .sp
 103 .ne 2
 104 .na
 105 \fB\fB-f\fR \fIpattern-file\fR\fR
 106 .ad
 107 .RS 19n
 108 Takes the list of patterns from \fIpattern-file\fR.
 109 .RE
 110 
 111 .sp
 112 .ne 2
 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
 123 \fB\fB-h\fR\fR
 124 .ad
 125 .RS 19n
 126 Suppresses printing of files when searching multiple files.
 127 .RE
 128 
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fB-i\fR\fR
 133 .ad
 134 .RS 19n
 135 Ignores upper/lower case distinction during comparisons.
 136 .RE
 137 
 138 .sp
 139 .ne 2
 140 .na
 141 \fB\fB-l\fR\fR
 142 .ad
 143 .RS 19n
 144 Prints the names of files with matching lines once, separated by new-lines.
 145 Does not repeat the names of files when the pattern is found more than once.
 146 .RE
 147 
 148 .sp
 149 .ne 2
 150 .na
 151 \fB\fB-n\fR\fR
 152 .ad
 153 .RS 19n
 154 Precedes each line by its line number in the file. The first line is 1.
 155 .RE
 156 
 157 .sp
 158 .ne 2
 159 .na
 160 \fB\fB-q\fR\fR
 161 .ad
 162 .RS 19n
 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.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB\fB-s\fR\fR
 171 .ad
 172 .RS 19n
 173 Legacy equivalent of \fB-q\fR.
 174 .RE
 175 
 176 .sp
 177 .ne 2
 178 .na
 179 \fB\fB-v\fR\fR
 180 .ad
 181 .RS 19n
 182 Prints all lines except those that contain the pattern.
 183 .RE
 184 

 185 .sp



 186 .ne 2
 187 .na
 188 \fB\fB-x\fR\fR
 189 .ad
 190 .RS 19n
 191 Prints only lines that are matched entirely.

 192 .RE
 193 
 194 .SH OPERANDS
 195 .sp
 196 .LP
 197 The following operands are supported:
 198 .sp
 199 .ne 2
 200 .na
 201 \fB\fIfile\fR\fR
 202 .ad
 203 .RS 8n
 204 Specifies a path name of a file to be searched for the patterns. If no
 205 \fIfile\fR operands are specified, the standard input will be used.
 206 .RE
 207 
 208 .SS "/usr/bin/fgrep"
 209 .sp
 210 .ne 2
 211 .na