方法1:
创建实战数据:
echo https://www.cnblogs.com/zhaokang2019/>a
echo https://www.cnblogs.com/zhaokang2019/>b
echo https://www.cnblogs.com/zhaokang2019/>c
echo https://www.cnblogs.com/zhaokang2019/>a.txt
查看数据源:
[[email protected] test]# find . -type f |xargs cat
https://www.cnblogs.com/zhaokang2019/
https://www.cnblogs.com/zhaokang2019/
https://www.cnblogs.com/zhaokang2019/
https://www.cnblogs.com/zhaokang2019/
通过find命令查找,然后通过管道,xargs 调用sed命令完成替换。
find . -type f |xargs sed -i ‘s#https://www.cnblogs.com/zhaokang2019/#https://www.cnblogs.com/guobaoyan2019/#g‘
替换后,查看数据:
[[email protected] test]# find . -type f |xargs cat
https://www.cnblogs.com/guobaoyan2019/
https://www.cnblogs.com/guobaoyan2019/
https://www.cnblogs.com/guobaoyan2019/
https://www.cnblogs.com/guobaoyan2019/
原文地址:https://www.cnblogs.com/zhaokang2019/p/10363175.html