fgrep - search a file for a character string
Synopsis
Description
Environment Variables
See Also
Diagnostics
/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:
-b 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. -c Only a count of matching lines is printed. -e string_list Specifies one or more strings, separated by newline characters. A line is selected if one or more of the specified strings are found. -f string_file 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. -h 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. -i Upper- and lowercase differences are ignored when searching matches. -l The names of files with matching lines are listed (once) separated by newlines. -n Each line is preceded by its line number in the file. Line numbers start with 1. -v All lines but those matching are printed. -x (Exact) only lines matched in their entirety are printed. The following options are supported as extensions: -r 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. -R 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. -z 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.
LANG, LC_ALL See locale(7). LC_CTYPE 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.
Heirloom Toolchest | FGREP (1) | 1/24/05 |