There are mutiple port configuration in each XML block in a XML file.
The example below has two port configurations. One in <Server>
, another in <Connector>
.
I want to change port in <Connector>
block only.
In this case, how can I solve this using sed
command?
(I need a solution which only uses sed
command because it should be run on any unix env.)
(I want to indicate specific block as name. It is not applicable way to change n-th block for matching port
text. Because there are more port
configurations as the comment in a file.)
server.xml
<?xml version='1.0' encoding='UTF-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="80" protocol="HTTP/1.1"/>
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps"/>
</Engine>
</Service>
</Server>