Search file(s) for lines that match a fixed string

      fgrep <options> ...

fgrep is the same as `grep -F'

all other options are the same as grep 

It's a popular fallacy that fgrep stands for fast-grep, in fact fgrep means fixed-string grep.

fgrep implements the Aho–Corasick string matching algorithm which is very fast at matching multiple strings in the input stream/file. So if fgrep is used like this:

fgrep -f patternlist.txt largetextfile.txt

it is much faster than

grep -f patternlist.txt largetextfile.txt

Matching a single pattern with fgrep is not significantly faster than grep.

"The knowledge imposes a pattern, and falsifies, For the pattern is new in every moment..." ~ T. S. Eliot


egrep - Search file(s) for lines that match an extended expression
gawk - Find and Replace text within file(s)
grep - Search file(s) for lines that match a given pattern
Equivalent Windows command: FINDSTR - Search for strings in files

Copyright © SS64.com 1999-2017
Some rights reserved