(
Global
Regular
Expression and
Print) A Unix pattern matching utility that searches files for a string of text and outputs the line that contains the pattern. Grep came from ed, a Unix text editor, in which the command
g/re/p meant "display all text in the file that matches this." That single function became a utility itself, available on all major platforms today. This is an example of the rich family of command line functions built into Unix long before Windows
The following real life example used grep to find occurrences of the text "xfiles.lst" within any .CMD files in the default folder. The results show the matching files and text. See
Unix.
Grep Windows Example
The command grep "xfiles.lst" *.cmd looks for CMD files that contain the text xfiles.lst. Grep found NEWXMLM.CMD and WHATSNEW.CMD matching the text string.