Name

fgrep

Synopsis

fgrep [options] string [files]

Search one or more files for lines that match the specified text string. Exit status is 0 if any lines match, 1 if not, and 2 for errors. fgrep is faster than normal grep searches, but less flexible: it can only find fixed text, not regular expressions.

See grep for the list of available options. Also see egrep.

Examples

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

fgrep -v ' ' file

Print lines in file that contain the words in the file spell_list:

fgrep -f spell_list file

Get Linux in a Nutshell, 6th 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.