Name

fgrep

Synopsis

    fgrep [options] [pattern] [files]

Search one or more files for lines that match a literal, text-string pattern. Because fgrep does not support regular expressions, it is potentially faster than grep (hence fgrep, for fast grep). Exit status is 0 if any lines match, 1 if not, and 2 for errors. See also egrep and grep.

The options for fgrep are the same as for egrep, including the Solaris versus GNU differences. See egrep for the full list.

Examples

Print lines in file that don’t contain any spaces:

    fgrep -v ' ' file

Print lines in file that contain the words in spell_list :

    fgrep -f spell_list file

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.