Chapter 3. The Grep Family (Gnu & Sons)

The UNIX grep family consists of the commands grep, egrep, and fgrep. The grep command globally searches for regular expressions infiles and prints all lines that contain the expression. Theegrep and fgrep commands are simply variants of grep. The egrep command is an extended grep, supporting more RE metacharacters. The fgrep command, called fixed grep, and sometimes fast grep, treats all characters as literals; that is, regular expression metacharacters aren't special—they match themselves.

Linux uses the Gnu version of grep, which in functionality is much the same as grep, but better. In addition to POSIX character classes (see Tables 3.1 and 3.2), there are a number of new options, including -G, -E, ...

Get Linux Shells by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.