How can I extract strings from one file to insert (modified) in a different file?

problem is the following: I have an xml file with data and I am looking for a small part of the data to write it into a new file: original file: <service> <disable-telnet>no</disable-telnet> <disable-http>no</disable-http> <disable-http-ocsp>no</disable-http-ocsp> <disable-snmp>no</disable-snmp> <disable-userid-service>no</disable-userid-service> <disable-userid-syslog-listener-udp>no</disable-userid-syslog-listener-udp> </service> <hostname>PaloAlto1</hostname> <ip-address>10.10.100.11</ip-address> <netmask>255.255.255.0</netmask> <default-gateway>10.10.100.1</default-gateway> <dns-setting> <servers> <primary>1.1.1.1</primary> <secondary>1.0.0.1</secondary> it is unique that the hostname part is…

Details