Grep

grep is a command line utility originally written for use with the Unix operating system. The default behaviour of grep takes a regular expression on the command line, reads standard input or a list of files, and outputs the lines containing matches for the regular expression. The name comes from a command in the Unix text editor ed that takes the form:
g/re/p
This means "search globally for matches to the regular expression re, and print lines where they are found". There are various command line switches available when using grep that modify the default behavior. There are many derivatives of grep, for example agrep which stands for approximate grep to facilitate fuzzy string searching, fgrep for fixed pattern searches, and egrep for searches involving more sophisticated regular expression syntax. Tcgrep is a rewrite of grep and uses Perl regular expression syntax. All these variations of grep have been ported to many computer operating systems. The Perl programming language provides a pattern matching function named grep, as do other languages. As the name "grep" neatly fits the phonology of English, it is often used as a verb, meaning to search – usually, to search a known set of files, as one would with the grep utility. The direct object is the set of files searched: "Joe grepped his Usenet spool for his name." Contrast google, meaning to search an unknown set of files (the entire Web) with the Google search engine. "Mary googled for Wikipedia references." The word "grep" has also become a synonym for regular expressions themselves. Many text- and word processors now employ regular expression search features, which those applications will often refer to as a "grep tool" or "grep mode" in which one creates "grep patterns", hence the confusion, especially in non-Unix environments.

Examples

To search all files in the current directory for the string "foo".
grep foo *
To search all files in the current directory and all its subdirectories for the string "foo".
grep -r foo *

External links

 

<< PreviousWord BrowserNext >>
hay
straw
loom
drainage
earth observation satellite
leiden
cambyses ii of persia
darius
demosthenes
catiline
caesar
shovelware
clark county
soundtrack
mise en scene
automatic teller machine
embedded system
film format
the young ones
turing tarpit
xenu
maoism
dow
dow jones & company
world council of churches
nicholas i of russia
enrico berlinguer
four cardinal principles
buttock
radio telescope
parsley, sage, rosemary and thyme
the graduate (soundtrack)
list of operettas
bookends
the pirates of penzance
concert in central park by simon and garfunkel
constantine viii
history of wales
battle of tours
xylem
banach fixed point theorem
die fledermaus
entropy encoding
church integer