sed replace content within double quotes

后端 未结 3 1733
失恋的感觉
失恋的感觉 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:08

    sed 's/\([[:blank:]]android:versionName="\)[^"]*"/\1Your New Value"/' YourFile
    
    • assuming that all section that have android:versionName will be changed
    • with GNU sed still better with replacing [[:blan:k]] by \(^\|[[:blank:]]\) (and a -i if direct modification avoiding temporary file)

提交回复
热议问题