I am attempting to add configuration to an xml file inside docker (which I believe is unimportant) I have the configuration pieces I want to insert into the xml file in another file.
The configuration file looks a little like this
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
The file conataining the text I wish to insert looks a little like this:
<datasource jndi-name="java:/PostgresDS" pool-name="PostgresDS">
<connection-url>jdbc:postgresql://localhost:5432/tabzpoc</connection-url>
<driver>postgresql-42.4.2.jar</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
I want the contents of the second file to be inserted after the <datasources>
tag in the first file. I have tried a few separate ways with sed and awk but do not seem to be able to nail it. If someone could point me in the right direction, I would be grateful