我尝试通过以下方式在所有 .c 文件中递归搜索模式
> grep -lr search-pattern *.c
Run Code Online (Sandbox Code Playgroud)
但是得到了这个作为输出
> grep: *.c: No such file or directory
Run Code Online (Sandbox Code Playgroud)
当我使用这个时:
> grep -lr search-pattern *
Run Code Online (Sandbox Code Playgroud)
我得到了很多。具有模式的目录中的 c 文件。
前面的表达有什么问题?
enz*_*tib 27
我建议使用以下--include选项grep:
grep -lr --include='*.c' search-pattern .
Run Code Online (Sandbox Code Playgroud)