linux命令: sed配合grep批量替换
sed -i "s/<old_string>/<new_string>/g"
grep -rl <old_string> ./`
sed与grep组合
sed替换文件中的文本
grep查找存在文本的文件
sed
格式
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-i 解释:
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if SUFFIX supplied)
替换命令
sed -i "s/<old_string>/<new_string>/g" <文件0> <文件1> <文件2> ...
grep
格式
-r, --recursive like --directories=recurse 递归查找
-l, --files-with-matches print only names of FILEs containing matches 只显示文件名
递归查找存在字符串的文件名列表
grep -rl <old_string> ./