method1

1
2
sed -i "s/oldString/newString/g"  `grep oldString -rl /path`
sed -i "s/oss_room_v2/oss_bi_all_room/g" `grep oss_room_v2 -rl /home/hadoop/nisj/automationDemand/idfaQuery`

method2

1
2
grep oldString -rl /path | xargssed -i "s/oldString/newString/g"
grep data_chushou_pay_info -rl /home/hadoop/nisj/automationDemand/idfaQuery | xargs sed -i "s/data_chushou_pay_info/oss_bi_all_chushou_pay_info/g"

也可以在grep子句中添加过滤,如:【grep oss_room_v2 -rl /home/hadoop/nisj/automationDemand/idfaQuery/*.py】

写在最后

欢迎大家关注鄙人的公众号【麦田里的守望者zhg】,让我们一起成长,谢谢。
微信公众号