如何在多个目录中查找具有给定字符串的文件?

Eli*_*eth 1 grep files

我试过:

grep "6 0 1 1      0.4154" /media/linux/DATADISK/*
Run Code Online (Sandbox Code Playgroud)

但它不会在目录 DATADISK 的子目录中搜索。

Zé *_*off 5

grep的手册页:

-r, --recursive
          Read all files under each directory, recursively,
          following symbolic links only if they are on the command
          line.
Run Code Online (Sandbox Code Playgroud)

所以grep -r ...会做的伎俩。当grepping 多个文件时,我发现还可以添加,-H以便也打印匹配文件的名称(这是 Linux 上的默认值,但不是其他平台上的默认值)。