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

it is much faster than

grep -f patternlist.txt largetextfile.txt

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


Related linux commands:

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


Te ayudó?