码迷,mamicode.com
首页 > 系统相关 > 详细

Linux find命令使用正则表达式

时间:2020-03-14 18:22:58      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:who   linu   sea   not   basic   xtend   posix   file   line   

如果想要在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命令使用正则表达式

标签:who   linu   sea   not   basic   xtend   posix   file   line   

原文地址:https://www.cnblogs.com/jmliao/p/12493324.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!