grep is an application, the command line is to search out the data and find the lines that an expression matches. is used. Grep was originally for the operating system of Unix was written, but nowadays, for all operating systems, Unix-like available. The name of the grep from the Command g/re/p in the text editor Ed comes in. (Stands for globally search a regular expression and print means a expression for the global search, and print) that perform the same task: a file (or standard input, or any other) for global search and lines that an expression matches are found, and in the standard output prints.
in the editor ed, which, by Ken Thomson written. grammatical there were lines that contain a particular pattern were printed. Ken Thomson program grep to be independent, to do this, the design will need to ed. In the tips page that in Version 4 of Unix. there is an official date create grep quarter April 1973 are listed.
grep the files that arguments have been specified, or the input . to find lines that contain an expression are search. (If in the arguments file was not specified). Lines found on the standard output print. For example, suppose a text file called fruitlist.txt we have that the number of fruit in which it is written. Want lines that contain the word apple, are we find:
grep apple fruitlist.txt
matching when that occurs, the sequence of characters detected. For example, lines that include pineapple and apples are, regardless of border, that between the words there printed. (Assuming the lines in the file, exist)
however, the pattern of that in the argument specified to be case-sensitive. So in the above example, if the linear contains the word Apple (with the letter A) exist, then the line cannot be detected. Unless in that line, besides the word Apple., the word apple also exist. Can be the capability of being sensitive to large and small letters by specifying the option -i in command line off.
at the command line can be multiple files for a specific search. For example, to search out all the files that name them .txt termination. can be * used:
grep apple *.txt
of phrases can be used for searching patterns of text more advanced. For example, to find all the lines that with the letter a start can be followed by any character enviable, have to be placed and then ple come. you can use the following command.
grep ^a.ple fruitlist.txt
As said before, the grep command in the editor ed, there was that to do the same, were used. Before the program, independent grep to search for file arise, etc. to search for a template, should such a thing was done:
ed fruitlist.txt
g/^a.ple/p
q
the first recipe file in editor opens. Recipe of the second pattern have been asked to search and makes the results in the printed page. Ordered the third time from the editor exits.
External links [edit] grep also can be options on the command line to receive this option, the behavior of grep to specify. For example, the option-l (letter L) makes up the grep instead of lines containing the pattern to be printed. name of the file in which the desired line is located, in print.