Linux find命令使用正则表达式
Posted IUNI_JM
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux find命令使用正则表达式相关的知识,希望对你有一定的参考价值。
如果想要在find命令中使用正则表达式,需要指定正则表达式类型
-regextype type
Changes the regular expression syntax understood by -regex and -iregex tests which occur later on the command line. Currently-implemented types are emacs (this is the default), posix-awk, posix-basic, posix-egrep and posix-extended.
-regex pattern
File name matches regular expression pattern. This is a match on the whole path, not a search. For example, to match a file named `./fubar3', you can use the regular expression `.*bar.' or `.*b.*3', but not `f.*r3'. The regular expressions understood by find are by default Emacs Regular Expressions, but this can be changed with the -regextype option.
example:
find /you/find/dir -regextype posix-extended -regex "regex"
以上是关于Linux find命令使用正则表达式的主要内容,如果未能解决你的问题,请参考以下文章