Linux find命令获取文件中的所有文本并打印文件路径



我需要获取文件夹中匹配文件中的所有文本。但是,同时也需要获得匹配的文件路径。如何使用以下命令获取匹配的文件路径。

find . -type f -name release.txt | xargs cat

tryfind . -type f -name release.txt -exec grep -il {} ; | xargs cat

跳过xargs,只需执行:

find . -type f -name release.txt -exec sh -c 'echo "$1"; cat "$1"' _ {} ;

最新更新