The name comes from ed and similar editors, and is derived from global / regular expression / print.
Grep is a command-line utility for searching plain-text data sets for lines matching a regular expression. Grep was originally developed for the Unix operating system, but is available today for all Unix-like systems.
There are many programming languages which include a command or statement called
grep; please simply use that language's tag for questions which do not pertain to the Unix utility.
The following are the several implementations of grep available in some Unix environments:
- egrep: same as
grep -E- Interprets the pattern as an extended regular expression.
- fgrep: same as
grep -F- Interprets the pattern as a list of fixed strings, separated by newlines, any of which is to be matched.
- pgrep: displays the processes whose names match a given regular expression.
-f file- Obtain patterns from file, one per line.
-i- Ignore case distinctions in both the pattern and the input files.
-o- Show only the part of a matching line that matches the pattern.
-c- Print a count of matching lines for each input file.
-R- Read all files under each directory recursively.
-v- Invert the sense of matching to select non-matching lines.
- How to find all files containing specific text on Linux?
- How do I grep recursively?
Other Stack Exchange sites
- tagged grep on Unix & Linux
- tagged grep on Ask Ubuntu
- tagged grep on Super User
- tagged grep on Server Fault