1. Explanation: A single string that describes or matches a series of strings that conform to a certain syntactic rule.
Action object: String
Many are used in document editors or other tools to retrieve and replace text content that conforms to patterns.
Common Grep,sed,awk
2.grep filtering, printing;-incvabc
-I ignores case,-n displays line numbers, and-c counts the number of rows that meet the requirements;-V prints rows that do not conform to the requirements,-an prints rows that match and the next n rows,-bn on n rows,-cn up and down n rows.
grep ' halt '-n-a2/home/jason/passwd prints the line that meets the requirements and the following two lines, plus the line number display
grep ' bash '-c passwd prints rows that meet the required line number
Grep-nv ' nologin ' passwd prints lines without nologin and displays line numbers
grep ' [0-9] ' passwd prints all rows that contain numbers
Grep-v ' ^# ' inittab print all lines that do not start with #
Grep-v ' ^# '/home/jason/inittab |grep-v ' ^$ ' prints all lines that do not start with # and are not empty
Vim Greptest2.txt
123
Abc
55W
abc2345
#ljadj
grep ' ^[^a-za-z] ' greptest2.txt prints lines that do not start with a letter, [^] table negation, except for characters inside []
grep ' [^a-za-z] ' greptest2.txt contains characters other than letters
Shell Learning--Regular expression