正则表达式 - Linux上,如何让find命令支持正则查找?
PHP中文网
PHP中文网 2017-04-17 15:55:00
0
2
534
PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
大家讲道理
-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.

This parameter will affect the matching behavior of -regex [pattern], similar to using different dialects to parse regular expressions.
After my experiment, I feel like writing this

find . -regextype posix-extended -regex './autojump.(bash|zsh|sh)'
或者
find . -regextype posix-extended -regex './autojump.(ba|z)?sh'
The regular matching of

./auto..../是不能省略的,find cannot only match part of it, but must match completely (understand).

==update==
If the previous path is very long, you can match it like this

find . -regextype posix-extended -regex '.*autojump.(ba|z)?sh'
伊谢尔伦

If you use find * and then use egrep, what do you think?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!