grep, print lines matching a pattern. Node: Grep Programs

PREV Diagnostics UP Top NEXT Regular Expressions

Chapter 4: GREP programs

GREP searches the named input files (or standard input if no files are named, or the file name `-' is given) for lines containing a match to the given pattern. By default, GREP prints the matching lines. There are three major variants of GREP, controlled by the following options.


Interpret pattern as a basic regular expression. This is the default.


Interpret pattern as an extended regular expression.


Interpret pattern as a list of fixed strings, separated by newlines, any of which is to be matched.

In addition, two variant programs EGREP and FGREP are available. EGREP is similar (but not identical) to `grep -E', and is compatible with the historical Unix EGREP. FGREP is the same as `grep -F'.

PREV Diagnostics UP Top NEXT Regular Expressions