1fgrep(1)                         User Commands                        fgrep(1)
2
3
4

NAME

6       fgrep - search a file for a fixed-character string
7

SYNOPSIS

9       /usr/bin/fgrep [-bchilnsvx] -e pattern_list [file...]
10
11
12       /usr/bin/fgrep [-bchilnsvx] -f file [file...]
13
14
15       /usr/bin/fgrep [-bchilnsvx] pattern [file...]
16
17
18       /usr/xpg4/bin/fgrep [-bchilnqsvx] -e pattern_list [-f file]
19            [file...]
20
21
22       /usr/xpg4/bin/fgrep [-bchilnqsvx] [-e pattern_list] -f file
23            [file...]
24
25
26       /usr/xpg4/bin/fgrep [-bchilnqsvx] pattern [file...]
27
28

DESCRIPTION

30       The fgrep (fast grep) utility searches files for a character string and
31       prints all lines that contain that  string.  fgrep  is  different  from
32       grep(1)  and from egrep(1) because it searches for a string, instead of
33       searching for a pattern that matches an expression. fgrep uses  a  fast
34       and compact algorithm.
35
36
37       The  characters $, *, [, ^, |, (, ), and \ are interpreted literally by
38       fgrep, that is, fgrep does not recognize full  regular  expressions  as
39       does  egrep. These characters have special meaning to the shell. There‐
40       fore, to be safe, enclose the entire string within single quotes ().
41
42
43       If no files are specified, fgrep assumes standard input. Normally, each
44       line  that  is found is copied to the standard output. The file name is
45       printed before each line that is found if there is more than one  input
46       file.
47

OPTIONS

49       The  following  options  are  supported  for  both  /usr/bin/fgrep  and
50       /usr/xpg4/bin/fgrep:
51
52       -b                 Precedes each line by the block number on which  the
53                          line was found. This can be useful in locating block
54                          numbers by context. The first block is 0.
55
56
57       -c                 Prints only a count of the lines  that  contain  the
58                          pattern.
59
60
61       -e pattern_list    Searches  for a string in pattern-list. This is use‐
62                          ful when the string begins with a .
63
64
65       -f pattern-file    Takes the list of patterns from pattern-file.
66
67
68       -h                 Suppresses printing of files when searching multiple
69                          files.
70
71
72       -i                 Ignores  upper/lower case distinction during compar‐
73                          isons.
74
75
76       -l                 Prints the names of files with matching lines  once,
77                          separated by new-lines. Does not repeat the names of
78                          files when the pattern is found more than once.
79
80
81       -n                 Precedes each line by its line number in  the  file.
82                          The first line is 1.
83
84
85       -s                 Works  silently,  that  is,  displays nothing except
86                          error messages. This  is  useful  for  checking  the
87                          error status.
88
89
90       -v                 Prints  all lines except those that contain the pat‐
91                          tern.
92
93
94       -x                 Prints only lines that are matched entirely.
95
96
97   /usr/xpg4/bin/fgrep
98       The following options are supported for /usr/xpg4/bin/fgrep only:
99
100       -q    Quiet. Does not write anything to the standard output, regardless
101             of  matching  lines.  Exits  with zero status if an input line is
102             selected.
103
104

OPERANDS

106       The following operands are supported:
107
108       file    Specifies a path name of a file to be  searched  for  the  pat‐
109               terns.  If  no  file operands are specified, the standard input
110               will be used.
111
112
113   /usr/bin/fgrep
114       pattern    Specifies a pattern to be used during the search for input.
115
116
117   /usr/xpg4/bin/fgrep
118       pattern    Specifies one or more patterns to be used during the  search
119                  for  input.  This operand is treated as if it were specified
120                  as -e pattern_list.
121
122

USAGE

124       See largefile(5) for the description of  the  behavior  of  fgrep  when
125       encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
126

ENVIRONMENT VARIABLES

128       See  environ(5) for descriptions of the following environment variables
129       that affect the execution of fgrep: LC_COLLATE, LC_CTYPE,  LC_MESSAGES,
130       and NLSPATH.
131

EXIT STATUS

133       The following exit values are returned:
134
135       0    If any matches are found
136
137
138       1    If no matches are found
139
140
141       2    For  syntax  errors  or  inaccessible  files, even if matches were
142            found.
143
144

ATTRIBUTES

146       See attributes(5) for descriptions of the following attributes:
147
148   /usr/bin/fgrep
149       ┌─────────────────────────────┬─────────────────────────────┐
150       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
151       ├─────────────────────────────┼─────────────────────────────┤
152       │Availability                 │SUNWcsu                      │
153       └─────────────────────────────┴─────────────────────────────┘
154
155   /usr/xpg4/bin/fgrep
156       ┌─────────────────────────────┬─────────────────────────────┐
157       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
158       ├─────────────────────────────┼─────────────────────────────┤
159       │Availability                 │SUNWxcu4                     │
160       ├─────────────────────────────┼─────────────────────────────┤
161       │CSI                          │Enabled                      │
162       └─────────────────────────────┴─────────────────────────────┘
163

SEE ALSO

165       ed(1), egrep(1), grep(1),  sed(1),  sh(1),  attributes(5),  environ(5),
166       largefile(5), XPG4(5)
167

NOTES

169       Ideally, there should be only one grep command, but there is not a sin‐
170       gle algorithm that spans a wide enough range of space-time tradeoffs.
171
172
173       Lines are limited only by the size of the available virtual memory.
174
175   /usr/xpg4/bin/fgrep
176       The /usr/xpg4/bin/fgrep utility is identical to  /usr/xpg4/bin/grep  -F
177       (see grep(1)). Portable applications should use /usr/xpg4/bin/grep -F.
178
179
180
181SunOS 5.11                        24 Mar 2006                         fgrep(1)
Impressum