sed replace content within double quotes

后端 未结 3 1729
失恋的感觉
失恋的感觉 2021-01-06 06:56

I need to replace the versionName in a xml file from a shell script using sed.



        
3条回答
  •  有刺的猬
    2021-01-06 07:25

    Considering the nature of xml and the version number, it is actually very safe to use a simpler command:

    sed -i '/versionName/s/".*"/"NEW VERSION NAME"/' AndroidManifest.xml
    

    P.S. in my opinion, it is very important to be able to simplify your shell script based on specific circumstances and reasonable assumptions.

提交回复
热议问题