this is the structure of xml file:
<test.file>
<set name="parameter1" serializeAs="String">
<value>True</value>
</set>
<set name="parameter2" serializeAs="String">
<value>True</value>
</set>
</test.file>
I want to edit value from True to False for Parameter2 when I use this command: xmlstarlet ed -u //test.\file/set/value -v False filename It is updating both value from True to False. How can I control to edit the value only for name="parameter2"?
Thank u!
EDIT: Since OP is asking to make changes on a specific tag's value so changed code according to it.
xmlstarlet ed -u "//test.file/set[@name='parameter2']/value" -v "false" Input_file.xml
Following xmlstarlet
command may help you here.
xmlstarlet ed -u "/test.file/set/value" -v "false" Input_file.xml
To do inplace update into xml file itself use following.
xmlstarlet ed -L -u "/test.file/set/value" -v "false" Input_file.xml