One. grep
grep parameters:
- n: Show Line Numbers
- o: Show only matching content
- Q: silent mode, no output, you have to use $? To determine the success of the execution, that is, there is no filtering to the desired content
- L: If the match succeeds, only the file name is printed, the failure is not printed, usually-rl together,grep-rl ' root '/etc
-A: If the match is successful, print the matching line together with the N rows after the period
- b: If the match succeeds, the matching row and the first n rows of the period are printed together
- C: If the match succeeds, print the matching row and the N rows before and after the period
--color
- C: If the match succeeds, the number of rows to match is printed
- e: equals grep, extended
-I: Ignore case
- v: inverse, mismatch
- w: match word
[Email protected] ~123[[email protected]"root" 123 [[email protected]"root"123
Two. Regular introduction
^ beginning of the line
$ End of line
. Any single character other than the line break
* Leading characters of the Spirit song or multiple
. * All characters
[] any character within a character group
[^] reverse each character within a character group (does not match each character in a group of characters)
^[^] lines that begin with characters within a non-character group
[A-z] lowercase Letter
[A-z] capital letters
[A-z] uppercase and lowercase letters
[0-9] number
\< words are usually separated by spaces or special characters, and successive strings are treated as words.
\> Word Tail
Shell Regular Expression