Regular Expressions (REGULAR): A set of rules and methods defined for processing a large number of strings,
Common Command Parameters
Basic Regular Expressions
. : There is only one character (including spaces) *: Repeat any of the preceding 0 or more characters. *: matches any character ==> all, including spaces \: Escape character, let meaningful character, display prototype \$- -$ itself ^: ^d file starting with D $:/$ in/End style ^$: Represents a blank line grep-vn "^$" h.txt-no blank line- n displays line number sed-r ' s# (. *) fff#i am \1#g ' h.txt just take each Line () Something inside R==reqular[abc] matches any character in the character set [0-9] Match 0-9 [A-z] a-z[^abc] does not match any character in the character set, which is equivalent to taking anti-a\{n,m} Repeat the previous letter, N to M times grep "0\{2\}" H.txt repeat 0 2 times ==> egrep "0{2}" h.txt ==> grep-e "0{2}" H.txt \{n,\} repeats at least n times \{,m\} repeat more than m times Note: egrep, Sed-r filter General special characters can not be escaped \w : print only the letter grep "\w" H.txt --A B c d e F g h i \w : print non-letter \b : match the delimiter of the word grep "\bhello\b" h.txt\d : Represents a number
Common Command Display
Linux grep/egrep Command Detailed
Linux sed command detailed
Linux awk Command Details
Extended Regular Expression
Extended Regular expression: more for Egrep,grep-e 1. + Repeat one or more of the characters Grep-eo "Go+d" h.txt--god good 2.? Repeat 0 or one greater range Grep-eo "G?d" h.txt--- gd, D grep-eo "Go?d" h.txt-- gd God 3. | Query multiple conforming strings Grep-eo "Hello|world"--Hello World 4. () find the "user group" string egrep "G (la|oo) d" H.txt-good Glad
Some little knowledge about the regular
1.Linux applies To: Grep,egrep,awk,sed, 2. The difference between the wildcards regular, such as ls *.log here is the * represents all 3. Linux is generally in the Behavioral Unit 4. Note Character Set export Lc_all=c
Detailed description of the Linux regular expression