*** Welcome to piglix ***

Grep

Grep
Original author(s) Ken Thompson
Initial release November 1974; 42 years ago (1974-11)

grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. Its name comes from the ed command g/re/p (globally search a regular expression and print), which has the same effect: doing a global search with the regular expression and printing all matching lines. Grep was originally developed for the Unix operating system, but is available today for all Unix-like systems.

First appearing in Version 4 Unix, grep was created by Ken Thompson as a standalone application adapted from the regular expression parser he had written for ed (which he also created). In ed, the command g/re/p would print all lines matching a previously defined pattern. Stating that it is "generally cited as the prototypical software tool", Doug McIlroy credited grep with "irrevocably ingraining" Thompson's tools philosophy in Unix.

grep searches files specified as arguments, or, if missing, the program's standard input. By default, it reports matching lines on standard output, but specific modes of operation may be chosen with command line options.

A simple example of a common usage of grep is the following, which searches the file fruitlist.txt for lines containing the text string apple:

Matches occur when the specific sequence of characters is recognized, for example, lines containing pineapple or apples are printed regardless of word boundaries. However, the search pattern specified as an argument is case sensitive by default, so this example's output does not include lines containing Apple (with a capital A) unless they also contain apple. Case-insensitive matching occurs when the argument option -i (ignore case) is given.


...
Wikipedia

...