I only have awk, sed, xmllint and ex available to me.
I need to modify a text file. What it is now:
<!--
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" maxPostSize="16777216" minSpareThreads="10"
enableLookups="false" acceptCount="10" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="http" proxyName="<subdomain>.<domain>.com" proxyPort="80"/>
-->
I need to remove the XML comments and change the proxyName variable. What I need to change it to:
<Connector port="8090" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" maxPostSize="16777216" minSpareThreads="10"
enableLookups="false" acceptCount="10" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"
scheme="http" proxyName="proxy.company.com" proxyPort="80"/>
There are several instances of this block in this file. I only want to change the block that contains:
scheme="http" proxyName="<subdomain>.<domain>.com" proxyPort="80"/>
Thanks!
If you can use xmllint you can probably use xmlstarlet. If so, you can use XSLT to do this. Unfortunately xmlstarlet only supports XSLT 1.0 so it's not a pretty solution, but it works.
XML Input (input.xml)
XSLT 1.0 (test.xsl)
Command line/Output (This can be redirected to an output file.)