Replace text in a file using sed on windows

牧云@^-^@ 提交于 2020-07-23 03:51:07

问题


I am trying to replace a string in a .ism file using the SED command but it is failing for me. The line in the file is the product version which I want to change in every build.

<row><td>ProductVersion</td><td>1.0.0</td><td/></row>

And here is the command I'm trying:

c:\rt_cygwin\bin\sed -i -r "s/ProductVersion\\"+[0-9].+[0-9].+[0-9] /ProductVersion\"1.0.%BUILD_NUMBER%/" "D:\lm.ism"

Thanks


回答1:


c:\rt_cygwin\bin\sed -i -r "s/ProductVersion</td>[0-9].[0-9].[0-9]/ProductVersion 1.0.%BUILD_NUMBER%/" "D:\lm.ism"

You have extra quotes that is not in the example line that should be removed and as @jeb pointed out the portion is missing.



来源:https://stackoverflow.com/questions/6523390/replace-text-in-a-file-using-sed-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!