|
发表于 2005-11-27 15:20:15
|
显示全部楼层
Post by ibmwebzh
最近在学习正则表达式。昨天使用rpm -qa|grep [[:upper:]]时不小心打成了rpm -qa|grep [:upper:]。结果有一些没有大写的行也被显示出来。但我用wc -l看了一下,比rpm -qa的要少。它还是过滤了一些,那这个[:upper:]到底起了什么作用呢?看文档也没明白。希望朋友帮助我一下。
在[]character class set中,有一种特殊的形式叫posix character class.用[::],[..],或[==]来表示。其中,[::]表示character class.如[:upper:]表示大写字符集。要注意的是[::]必须包括在[]中。
“All three of these constructs must appear inside the square brackets of a bracket expression. For example [[:alpha:]!] matches any single alphabetic character or the exclamation point, [[.ch.]]
matches the collating element ch, but does not match just the letter c or the letter h. In a French locale, [[=e=]] might match any of e, è, or é. ”
详细的资料请参考sed&awk第二版。 |
|