正则表达式及Linux文本检查工具(3)

[:graph:] : 除空格符(空格键与(Tab)按键)外的其他所有按键
[root@linux ~]# grep '[[:graph:]]' test.txt 
This is a beautiful girl
So do you want to know who is her?
oh! I can`t tell you?
can you tell me your phone number?
My telphone number is 15648562351...
Beat wish to you ?
[root@linux ~]# 看看前面的源文件,对比一下,是不是?

[:space:] : 代表的是空白字符,包括空格键[Tab]等
[root@linux ~]# grep '[[:graph:]]' test.txt 
This is a beautiful girl
So do you want to know who is her?
oh! I can`t tell you?
can you tell me your phone number?
My telphone number is 15648562351...
Beat wish to you ?
[root@linux ~]# 这个演示的效果不太明显,你可以试一试"grep '[^[:space:]]' test.txt"

[:blank:] : 代表的是空格键与[Tab]按键
[:lower:] : 小写字母字符---------->"a-z"
[root@linux ~]# grep '[[:lower:]]' test.txt 
This is a beautiful girl
So do you want to know who is her?
oh! I can`t tell you?
can you tell me your phone number?
My telphone number is 15648562351...
Beat wish to you ?

[:upper:] : 大写字母字符---------->"A-Z"
[root@linux ~]# grep '[^[:lower:]]' test.txt 
This is a beautiful girl
So do you want to know who is her?
oh! I can`t tell you?
can you tell me your phone number?
My telphone number is 15648562351...
Beat wish to you ?这样写是不是也对呢?
[root@linux ~]# grep '[[:upper:]]' test.txt 
This is a beautiful girl
So do you want to know who is her?
oh! I can`t tell you?
My telphone number is 15648562351...
Beat wish to you ?

[:cntrl:] : 表示键盘上面的控制按键即包括"CR,LF,Tab,Del"
[:print:] : 代表可以打印出来的字符
[:xdigit:] :代表十六进制的数字类型->"0-9,A-F,a-f"
上面三个不经常使用,就不演示了

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/15419.html