如何将命令 find
和 grep
的结果合并为以下格式:filename: => string
?
例如,查找。 -maxdepth 2 -type f -name .env -exec grep 'CURRENT_ENV' {}\;
该命令将在找到 CURRENT_ENV
字符串时向我显示该行,例如CURRENT_ENV=staging
。我想按以下方式修改输出:./site1.com: CURRENT_ENV=staging
.
我不明白我怎样才能做到这一点。是否可以?
最佳答案
-H, --with-filename Print the file name for each match. This is the default when there is more than one file to search.
关于linux - 如何将 find 和 grep 的结果输出为 filename => found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51509172/