FGREP(1) User Commands FGREP(1)

fgrep - search a file for a character string

/usr/5bin/fgrep [-e string_list ...] [-f string_file] [-bchilnrRvxz] [string_list] [file ...]

/usr/5bin/posix/fgrep -e string_list ... [-f string_file] [-c|-l] [-bhinrRvxz] [file ...]

/usr/5bin/posix/fgrep -f string_file [-e string_list ...] [-c|-l] [-bhinrRvxz] [file ...]

/usr/5bin/posix/fgrep [-c|-l] [-bhinrRvxz] string_list [file ...]

The fgrep command searches the lines of the specified files (or of standard input) for occurrences of any of the newline separated strings in string_list. The default behavior is to print each matching line to standard output.

Both /usr/5bin/fgrep and /usr/5bin/posix/fgrep accept the following options:

Each line is preceded by the block number on which it was found. This is sometimes useful in locating disk block numbers by context. Block numbers start with 0.
Only a count of matching lines is printed.
Specifies one or more strings, separated by newline characters. A line is selected if one or more of the specified strings are found.
One or more strings, separated by newline characters, are read from string_file. If multiple -e or -f options are supplied to /usr/5bin/posix/fgrep, all of the pattern lists will be evaluated.
Normally, the name of each input file is printed before a match if there is more that one input file. When this option is present, no file names are printed.
Upper- and lowercase differences are ignored when searching matches.
The names of files with matching lines are listed (once) separated by newlines.
Each line is preceded by its line number in the file. Line numbers start with 1.
All lines but those matching are printed.
(Exact) only lines matched in their entirety are printed.

The following options are supported as extensions:

With this option given, fgrep does not directly search in each given file that is a directory, but descends it recursively and scans each regular file found below it. Device files are ignored. Symbolic links are followed.
Operates recursively as with the -r option, but does not follow symbolic links that point to directories unless if they are explicitly specified as arguments.
If an input file is found to be compressed with compress(1), gzip(1), or bzip2(1), the appropriate compression program is started, and fgrep searches for the pattern in its output.

/usr/5bin/s42/fgrep and /usr/5bin/posix2001/fgrep are identical to /usr/5bin/posix/fgrep.

See locale(7).
Determines the mapping of bytes to characters and the case mapping for the -i option.

ed(1), egrep(1), grep(1), sed(1), locale(7)

Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors or inaccessible files.

1/24/05 Heirloom Toolchest