grep [:digit:]实例
2016-10-24Finally, certain named classes of characters are predefined within bracket expressions, as follows. Their
names are self explanatory, and they are [:alnum:], [:alpha:], [:cntrl:], [:digit:], [:graph:], [:lower:],
[:print:], [:punct:], [:space:], [:upper:], and [:xdigit:]. For example, [[:alnum:]] means [0-9A-Za-z],
[[:upper:]] [A-Z]
[[:lower:]] [a-z]
[[:digit:]] [0-9]
[[:alnum:]] [0-9a-zA-Z]
[[:space:]] 空格或tab
[[:alpha:]] [a-zA-Z]
例如:
find abc/ -type f |grep -i \'[]{100}'
grep -i \'[a-z]{100}\' a.txt
tail -f looyuoms7814.log |grep \'[:graph:]\{100,}'
/^\S{1,100}$/
grep -o '[0-9]\{2\}' a.log
tail -f looyuoms7814.log |grep '[[:graph:]]\{200,\}'
grep -o '[0-9]\{2\}' a.log
grep '5[[:upper:]][[:upper:]]' data.doc #查询以5开头以两个大写字母结尾的行