February 2004
Beginner
200 pages
5h 40m
English
fgrep [options] [fixed_strings] [files] — grep
/bin stdin stdout - file -- opt --help --versionThe fgrep command is just like grep, but instead of accepting a regular expression, it accepts a list of fixed strings, separated by newlines. It’s the same as grep -F. For example, to search for the strings one, two, and three in a file:
$ fgrep 'one Note we are typing newline characters
two
three' myfilefgrep is commonly used with the lowercase -f option, which reads patterns from a file. For example, if you have a dictionary file full of strings, one per line:
$ cat my_dictionary_file aardvark aback abandon ...
you can conveniently search for those strings in a set of input files:
$ fgrep -f my_dictionary_file *
fgrep also is good for searching for nonalphanumeric characters like * and { because they are taken literally, not as metacharacters in regular expressions.
Read now
Unlock full access