使用正则表达式查找命令

使用正则表达式查找命令

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

我尝试在网页中寻找它man,但至今没有成功。

答案1

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.

相关内容