问题
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