Regular expressions: Formal notation, regular notation (Regular expression) regular expressions are described using a single string, matching a series of strings that conform to a rule of a sentence.
1) command format;
grep "Regular" string file
2) Command parameters
^ with what begins
$ with what end
\ escape Character
* Repeat 0 or more of the preceding characters
. * Match All characters
[] List the characters you want inside
[N1-N2] lists the range of characters that you want to include
. Have an arbitrary character
[^]# matches a character not in the specified range
\(.. \) Tag matching characters
\< anchoring the beginning of a word
>\ anchoring the end of a word
x\{m\}# repeat character X, m times
x\{m,\}# repeat character X, at least m times
x{m,n}# repeat character X, at least m times cannot be more than n times
\w matches literal and numeric characters [a-za-z0-9]
3) Command Introduction:
Command: Ps-ef |grep SVN find the specified process
Command: Ps-ef|grep svn-c or Ps-ef|grep-c svn to find the specified number of processes
Command: Cat text.txt|grep-f test2.txt Read keywords from file for search
Command: grep ' keyword ' test. TXT Find keyword search from file
Command: grep ' keyword ' test. TXT test. txt2 Finding keyword searches from multiple files
Command: PS aux | grep \[s] sh or PS aux |grep ssh| Grep-v "grep" grep does not show itself process
Command: Cat Test.txt|grep^u find the line content that has the U start
Command: Cat test.txt|grep ^[^u] Output line content that does not start with u
Command: Cat test.txt|grep hat$ Output The line contents of Hat end
Command: Cat test.txt|grep-e "Ed|at" displays content with an Ed or at character
Command: grep ' {a-z}\{7\} ' *.txt displays the current directory under the. TXT end-of-file all rows containing a string of at least 7 consecutive lowercase characters per string
Linux: Regular Expressions