欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

学习shell咯4 博客分类: Linux 正则表达式LinuxUnix 

程序员文章站 2024-02-22 16:28:40
...
vi,grep,sed和awk是Unix/Linux下处理文本的最重要的工具,而它们都与正则表达式密不可分

Regular Expression Metacharacters
^         Beginning-of-line anchor
$         End-of-line anchor
.         Matches one character
*         Matches zero or more of the preceding characters
[]        Matches one in the set
[x-y]     Matches one character within a range in the set
[^]       Matches one character not in the set
\         Used to escape a metacharacter
\<        Beginning-of-word-anchor
\>        End-of-word anchor
\(..\)    Tags match characters to be used later
x\{m\}    Repetition of character x, m times
x\{m,\}   Repetition of character x, at least m times
x\{m,n\}  Repetition of character x, at least m and not more than n times.