使用正则表达式查找命令

Ale*_*.Kh 5 regex find

我正在练习一个find命令和时刻,并对命令中正则表达式的用法感到好奇find(类似于grep)。命令支持吗?如果是这样,启用它的选项是什么?

我尝试在man页面中寻找它,但到目前为止没有成功。

sch*_*ity 11

man find:

-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.
Run Code Online (Sandbox Code Playgroud)

  • @Alex.Kh shell 元字符与正则表达式不同 - 请参阅 [为什么我的正则表达式在 X 中有效但在 Y 中无效?](https://unix.stackexchange.com/a/119906/65304) 中的答案 (3认同)