如果想要在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"

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2021-08-31
  • 2021-12-11
  • 2021-12-13
  • 2022-01-24
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2021-06-19
  • 2021-12-22
  • 2021-06-05
  • 2021-12-12
  • 2021-12-13
相关资源
相似解决方案