# 搜索含有特定字符串在某个目录并打印出文件名
grep -rl "www.baidu.com" /data
* -r, --recursive like --directories=recurse
* -l, --files-with-matches print only names of FILEs containing matches
# 批量查找与替换
sed -i "s/原字符串/新字符串/g" `grep 原字符串 -rl 所在目录`
sed -i "s/原字符串/新字符串/g" `grep 原字符串 -rl 所在目录`
# 统计数量
grep -rl "www.googletagmanager.com" ./en/| xargs ls -al|wc -l
来源:https://www.cnblogs.com/boundless-sky/p/12020585.html