一、批量删除指定字符串"slave-xxx":
grep -inr "slave-xxx" | awk -F ':' '{print $1}' | xargs -n1 -I {} sed -i '/slave-xxx/d' {}
二、批量替换指定字符串"slave-xxx":
grep -inr "slave-abc" | awk -F ':' '{print $1}' | xargs -n1 -I {} sed -i 's/"slave-abc",/"slave-DFG",/g' {}
三、批量替换指定字符串"dailybuild_xxx_subtask":
find ./ -name "*.groovy" | xargs -r -0 -P1 -n1 bash -c '
src="${1}";
echo "=will update the project name for: $src=";
sed -i "s/dailybuild_xxx_subtask/db_x1_subtask/g" ${src}
' '_'
四、参考链接:sed & 快速修改、删除、增加、过滤文件内容
https://blog.csdn.net/m0_61066945/article/details/126082242
https://www.cnblogs.com/caoweixiong/p/10234053.html
https://www.runoob.com/linux/linux-comm-xargs.html