When using the command:
-bash-4.2$ xmlstarlet ed -u "/configurations/rules/rule/branch" -v 'DAVID' config.xml > final.xml
I see that the output file was changed to DAVID, But it was changed globally every place the tag "branch" was declared.
But I only want to change it on one subnode, let's say "APP1", What is the command that I need to use? and is there a way to give the value 'DAVID' as a parameter?
<configurations>
<smtpHost>smtp3.gmail.com</smtpHost>
<smtpPort>25</smtpPort>
<emailFrom>[email protected]</emailFrom>
<emailSubject>Push notification</emailSubject>
<!-- Stash general URL-->
<gitViewerURL>http://mydtbld0005.gmail.com:7990/projects/</gitViewerURL>
<!-- repositories list and commit URL path per repo -->
<repositoryViewerPath name="hookTester" path="DevOps/repos/hooktester/commits/"/>
<separator>#@#</separator>
<catExe>cat</catExe>
<catExeWindows>type</catExeWindows>
<gitExe>git</gitExe>
<gitExeWindows>C:\\Program Files (x86)\\Git\\cmd\\git.exe</gitExeWindows>
<gitFolder>/gitdata/alm_mng.git</gitFolder>
<gitFolderWindows>c:\gitdata\alm_mng.git</gitFolderWindows>
<rules>
<rule>
<name>APP1</name>
<repo>hookTester</repo>
<branch>refs/heads/master</branch>
<emailTo>[email protected]</emailTo>
<path>F1/ido.xml </path>
</rule>
<rule>
<name>APP2</name>
<repo>hookTester</repo>
<branch>refs/heads/master</branch>
<emailTo>[email protected]</emailTo>
<path>F2/ido.xml </path>
</rule>
</rules>
</configurations>