UNIX provides three similar commands:
fgrep to select lines in files
that match a given pattern.
The differences between these three commands lie in the options and the algorithms that are used.
grep [option] pattern [file] egrep [option] pattern [file] fgrep [option] pattern [file]
fgrep, the pattern is not a regular expression (see below) but an ordinary character string.
When more than one file are used in argument, the name of the files that matches the pattern are added as a prefix to the selected lines.
grep is used to select lines in a file, for example to remove unwanted information produced by a previous command.
||Prefix each line of output with the 1-based line number within its input file|
||Invert the sense of matching, to select non-matching lines|
||Suppress normal output; instead print a count of matching lines for each input file|
||Ignore case distinctions in both the PATTERN and the input files|
||Suppress normal output; instead print the name of each input file from which output would normally have been printed|
||Suppress error messages about nonexistent or unreadable files|
||Use PATTERN as the pattern. If this option is used multiple times, search for all patterns given|
#select atomes in a PDB file grep ATOM 1DFB.pdb
egrep can use pattern regular expression. These are character strings that represent a pattern using generic characters and special characters (i.e., character with "meaning").