使用命令时:
-bash-4.2$ xmlstarlet ed -u "/configurations/rules/rule/branch" -v 'DAVID' config.xml > final.xml
我看到输出文件已更改为DAVID,但是在声明标签“分支”的每个地方都进行了全局更改。
但我只想在一个子节点上更改它,比如说“APP1”,我需要使用什么命令?有没有办法将值'DAVID'作为参数?
<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>