我试过:
grep "6 0 1 1 0.4154" /media/linux/DATADISK/*
Run Code Online (Sandbox Code Playgroud)
但它不会在目录 DATADISK 的子目录中搜索。
从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 ...
会做的伎俩。当grep
ping 多个文件时,我发现还可以添加,-H
以便也打印匹配文件的名称(这是 Linux 上的默认值,但不是其他平台上的默认值)。