display | more...
One of the grep variants on a Unix system. fgrep searches for fixed strings, unlike grep, which of course can search for regular expressions.

Since it's the least powerful of the fgrep/grep/egrep triumvirate, and since the man page entry used to say something like "fgrep uses a fast, compact algorithm", it's easy to imagine that fgrep would be the fastest of the three, but in fact, it's not; in general egrep (which is also the most general and powerful) is also the fastest. Consequently no one much bothers to use fgrep except perhaps when searching for variable strings which might contain regexp metacharacters which would be a nuisance to have to quote.

On several modern Unix systems (including GNU/Linux ones, and probably also Solaris and HP-UX), there's a single one all-purpose grep implementation which stands in for all three former variants. The name under which the one implementation is invoked merely controls which (if any) metacharacters will be interpreted in the pattern(s) being searched for. Internally, the implementation might switch among several avvailable algorithms based on the actual pattern being searched for, but the point is that the user no longer has to pick the algorithm explicitly by choosing among three separate commands; the algorithm chosen is an implementation detail, as it ought to be.

Log in or register to write something here or to contact authors.