Shell programming regular expression:
1: metacharacters []. *? + () | {}^ $
2: [a-z0-9] indicates one that matches any number and letter
3: [^ a-z] matches any letter
4: AB + c + indicates matching the characters before one or more plus signs.
5: AB * c * indicates that no or more characters before * are matched.
6: AB? C? Indicates matching? Character before
7: (AB) {2} c Represents a string that matches two AB characters.
8: (AB) * c (AB) + c (AB )? C has the same rules as 4, 5, and 6, but matches all characters in brackets.
9: ^ AB indicates matching the characters starting with AB, while [^ AB] indicates matching
10: \ <title \> only matches the word title, with spaces or line breaks as the Separator
In linux, The fgrep grep egrep command grep (global research regular expression and printing)
The fgrep command does not use regular expressions and matches all characters as common characters during search.
The grep command only supports regular expressions and does not support extended regular expressions.
The egrep command supports all extended regular expressions.
Common grep usage:
1: grep-v match the character grep-v '^ AB'/etc/passwd that is not included in the regular expression and does not start with AB
2: grep -- color: Mark matched characters in color.
3: grep-o only displays matched characters after filtering.
4: grep-A2 'abc'/etc/passwd: displays the matching characters and the above two lines matching the Character Line
5: grep-B2 'abc'/etc/passwd: displays the matching characters and the following two lines matching the character lines
6: grep-C3 'abc'/etc/passwd: displays the matching characters and the following and above two lines of the matching Character Line
7: grep-f/etc/shadow/etc/passwd indicates that the/etc/passwd file contains
Characters in/etc/shadow
8: grep-E indicates that extended regular expressions are supported, which is equivalent to egrep.
9: