The normal expression of grep is divided into basic REGEXP-Regular expressions
Extended REGEXP extending a regular-rule expression
Grep-a 2 indicates that the following two lines of the matched character are also displayed
Grep-b 2 indicates that the first two lines of the matched character are also displayed
Grep-c 2 indicates that both front and back lines of the matched character are displayed
Character matching
. Represents any one character
[] denotes any single character within the specified range
[^] denotes any single character that matches a specified range
Number of matches (extended regular expressions can be used without \ Backslashes to avoid being Bashell recognized)
* Indicates any time that matches one of its previous characters (including 0)
? Indicates that the previous character matches 0 or 1 times
+ means match its previous character at least 0 times, up to No limit
{M,n} indicates a match for its first character at least m times, and up to n times m must give the number n if the upper limit is not written
Position anchoring
^ Anchor Beginning
$ Anchor Line End
\< or \b Anchor word head
\> or \b Anchor ending
Group
() represents a set of data in parentheses
\1 matches its contents from the first parenthesis in the left number
\2 matches its contents from the second parenthesis in the left number
\3 ... In turn
Or
This symbol is a symbol of OR
Example: A|b indicates a matching character a or b
Extending a regular-rule expression
GREP-E indicates the use of an extended positive rule expression and can also be used Egrep
Egrep Extended Regular expression (note)