The grep command usually searches for a specified pattern match (character string sequence) within a text file; or series of text files.
There are three commands that are part of the grep family of commands:
grep, egrep, fgrep
fgrep (Fast grep): This command searches files for one or more pattern arguments. This command doesn’t understand the extended capabilities of regular expressions, instead, it does direct string comparison to find matching lines of text in the input. . Used to find fixed strings. Very fast in it’s search.
grep: The commonly used grep command. Accepts a subset of regular expressions. Pattern matching will be equivalent in speed until specific subsets of regular expressions are used
egrep (Extended grep): command accepts the full set of the regular expression capabilities. Will run slower when complex pattern matching sequences are used. If you include special characters in patterns typed on the command line, escape them by enclosing them in apostrophes to prevent inadvertent misinterpretation by the shell or command interpreter. To match a character that is special to egrep, put a backslash (\) in front of the character. It is usually simpler to use fgrep when you don’t need special pattern matching.