Skip to content
Tenshi Hinanawi edited this page Apr 30, 2012 · 1 revision

grep is a command line text search utility originally written for Unix. The name is taken from the first letters in global / regular expression / print, a series of instructions for the ed text editor. The grep command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output.

Download

Download from GNU

Variations

There are countless implementations and derivatives of grep available for many operating systems, as well as for aiding searches in third-party applications such as EnCase (computer forensic software). Early variants of grep included egrep and fgrep. The former applies an extended regular expression syntax that was added to Unix after Ken Thompson's original regular expression implementation. The latter searches for any of a list of 'fixed' strings using the Aho-Corasick algorithm. These variants are embodied in most modern grep implementations as command-line switches (e.g. -E and -F respectively in GNU grep). In such combined implementations, grep may also behave differently depending on the name by which it is invoked, allowing fgrep, egrep, and grep to be links to the same program. pcregrep is an implementation of grep that uses Perl regular expression syntax. Other commands contain the word 'grep' to indicate that they search (usually for regular expression matches). The pgrep utility, for instance, displays the processes whose names match a given regular expression. In Perl, grep is a built-in function that finds elements in a list. In functional programming languages, this higher-order function is typically named "filter" instead. The DOS, OS/2 and platforms provide the find command for simple string searches. Windows also provides the "findstr" command which approximates much of the functionality of “grep”, or you can use the cygwin grep ported version. A GnuWin32 version of grep is also available.

External Links

GNUE official page

Clone this wiki locally