使用egrep的,正则表达式 “^ {8} $” 正好8个字符的任意文件名匹配:发现-regex不承认有什么似乎是一个很好的查询
[email protected]:~/smsn+/kb/vcs/private$ ls | egrep "^.{8}$"
ac7t6-Xo
aQsqsC4-
a_wzemGk
[email protected]:~/smsn+/kb/vcs/private$
但是使用find,我是否使用POSIX扩展或普通的那种,这种模式行不通:
[email protected]:~/smsn+/kb/vcs/private$ find . -regex "^.{8}$"
[email protected]:~/smsn+/kb/vcs/private$ find . -regextype posix-extended -regex "^.{8}$"
[email protected]:~/smsn+/kb/vcs/private$
其实我尝试了所有的其他regextypes - emacs的,POSIX的基础,POSIX的AWK,POSIX,egrep的 - 作为上市here。
为什么不'LS ????????'? – Barmar
我不知道'ls'支持的通配符。谢谢! –
通配符由shell扩展,因此每条命令都会自动支持它们。 – Barmar