< 匹配一个单词的开头的空字符串,锚定开始。 \> 匹配一个单词的末尾的空字符串,锚定末尾。
\w 匹配一个字母数字组成的单词。
\W 匹配一个非字母数字组成的单词。
\‘ 匹配字符串开头的一个空字符串。
\’ 匹配字符串末尾的一个空字符串。
The various command-line options control how gawk interprets characters in regexps:
Nooptions :
In the default case, gawk provides all the facilities of POSIX regexps and the
previously described GNU regexp operators. GNU regexp operators described in Regexp
Operators. However, interval expressions are not supported.
–posix :
Only POSIX regexps are supported; the GNU operators are not special (e.g., ‘\w’
matches a literal ‘w’). Interval expressions are allowed.
–traditional :
Traditional Unix awk regexps are matched. The GNU operators are not special, interval
expressions are not available, nor are the POSIX character classes ([[:alnum:]], etc.).
Characters described by octal and hexadecimal escape sequences are treated literally, even
if they represent regexp metacharacters. Also, gawk silently skips directories named on the
command line.
–re-interval :
Allow interval expressions in regexps, even if –traditional has been provided. (–
posix automatically enables interval expressions, so –re-interval is redundant when –posix
is is used.)
Class Meaning
[:alnum:] Alphanumeric characters.
[:alpha:] Alphabetic characters.
[:blank:] Space and TAB characters.
[:cntrl:] Control characters.
[:digit:] Numeric characters.
[:graph:] Characters that are both printable and visible.
[:lower:] Lowercase alphabetic characters.
[:print:] Printable characters (characters that are not control characters).
[:punct:] Punctuation characters
[:space:] Space characters (such as space, TAB, and formfeed, to name a few).
[:upper:] Uppercase alphabetic characters.
[:xdigit:] Characters that are hexadecimal digits.

范围模板匹配从第一个模板的第一次出现到第二个模板的第一次出现之间所有行。如果有一个模板没 出现,则匹配
到开头或末尾。如$ awk ‘/root/,/mysql/’ test将显示root第一次出现到mysql第 一次出现之间的所有行。


Captcha Code