/abc/ Double slashes indicate that there are regular expressions inside
Use method in awk: awk '/ac/{print $0}' data.txt
.and\
awk '/ac/{print $0}' data.txt uses ac expressions to match data.txt data. Dots represent one character, multiple dots represent multiple characters
awk '/a\.c/{print $0}' data.txt matches ac expressions, backslashes are transfer characters
^ and $
/^abc/ means starting with abc
/abc$/ means ending with abc
/a[xyz]c/ axc ayc azc
/a[az]c/ Any lowercase letter between a and c
/a[a-zA-Z]c/ A and c can be any uppercase and lowercase letters
/a[^az]c/ There cannot be lowercase letters between a and c
/^a[az]c/ A string starting with a[az]c
* and +
/a*b/ * means that the preceding character can appear 0 or more times? Equivalent to matching /b/ /ab/ /aab/ /aaab/. . .
/a+b/ + means that the preceding character can appear one or more times, which is equivalent to matching /ab/ /aab/ /aaab/
/a?b/ ? means that the preceding character can be present or absent, so this can be b or ab
/ab{3}c/ {} means that the preceding character appears 3 times, so it is abbbc
/ab{3,5}c/ {} means that the preceding character can appear 3 to 5 times
/ab{3,}c/ {} means the preceding character appears at least 3 times
/(ab)+c/ () means that the previous ab appears repeatedly, which can be repeated many times, such as ababc, abababc