I Want to edit XML file thru bash shell script. I am stuck in finding a solution - Kindly share your suggestion if this can be resolved via bash shell script.
I want to add -Dcustom.properties=/fs0/share/custom.properties value to jvmParameters attribute In applicationServerInstance tag if it does not exists.
Input File:
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<applicationServer>
<applicationServerInstance id="app" serviceName=" App Server" rmiPort="15001" jvmParameters="-Xmx3072m" maxThreads="1000" programParameters="" distributed="false"/>
</applicationServer>
<blah>
</blah>
<blah abc="123">
</blah>
</properties>
Ideal Input File(Above file should be be updated as below):
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<applicationServer>
<applicationServerInstance id="app" serviceName=" App Server" rmiPort="15001" jvmParameters="-Xmx3072m -Dcustom.properties=/fs0/share/custom.properties" maxThreads="1000" programParameters="" distributed="false"/>
</applicationServer>
<blah>
</blah>
<blah abc="123">
</blah>
</properties>