How did grep get out?
It's going to take us discovering, "g/re/p" see, that's it. "Global Regular expression print" ==> "globally finds the regular expression (RE) and prints the resulting row. ”
The grep family consists of commands Grep,egrep and Fgrep. The latter two are variants of the former. One is fat, one is thin.
The advantage of using grep is that you do not need to start the editor to perform a find operation, and you do not have to put the pattern in "//", use grep much faster than VI, and many more command-line options.
Grep-option ' pattern ' filename or
|grep-option ' pattern '
See the Shell's regular expression above:
http://1076546426.blog.51cto.com/9959876/1702784
Options
|
Function |
-B |
Precede each line with its block number, which may be used when locating a disk block based on the context |
-C |
Displays the number of rows matched to, without displaying the contents of the row |
-H |
Do not display file names |
-I. |
Ignore case when matching characters |
-L |
Lists only the file names of the files where the matching rows are located (one at a time for each file name), separated by a newline character between the file names |
-N |
Precede each line with its relative line number in the file |
-S |
Silent operation, that is, only display error messages to check the exit status |
-V |
Reverse lookup, showing only rows that do not match
|
-W |
Find the expression as a word and apply it only to grep. =====\<\> |
Note: For more options, see: Grep-h or man grep
Metacharacters
|
Function |
+ |
Match one or more characters before the + sign |
? |
Match 1 or 0 leading characters |
A|b |
Match A or B |
() |
Character groups |
IDEA Development:
Example |
Annotations |
' [A-z]+ove ' |
Match 1 or more letters followed by a ove string |
' Lo?ve ' |
String matching L followed by Ove or ve |
' Love|hate ' |
Match one of the two strings of love and hate |
' Love (able|ly) ' |
Match loveable or lovely |
The Shell Three Musketeers grep