1 替换文件某一行
将文件./config/patchconfig/patch_config.json 的第二行替换为 "path": "../patchfiles",
将文件aaa.txt中的第三行替换为888
content=‘"path": "../patchfiles", ‘ sed -i "2c${content}" ./config/patchconfig/patch_config.json
sed -i ‘3c888‘ ./aaa.txt
参考:
https://blog.csdn.net/nanaranran/article/details/81203905
https://www.cnblogs.com/seasonzone/p/11274788.html
https://zhidao.baidu.com/question/878349927740895212.html
原文:https://www.cnblogs.com/wolbo/p/12320327.html