I am trying to add contents of a text file to middle of other text file , that too before a particular string. I used the below command to add text after a particulat string like
sed '/line3/ r data.txt' file1.txt (this will add contents of data.txt to file1.txt after "line3" string.
I am trying to add the contents of the file before a particular string. I cant assure the line number, so I cant use that method.
For example,
<xa-datasource-property
name="URL">jdbc:oracle:thin:@domain.com:1521:ora12121</xa-datasource-
property>
<xa-datasource-property name="User">username</xa-datasource-property>
<xa-datasource-property name="Password">password</xa-datasource-property>
<!-- Uncomment the following if you are using Oracle 9i
<xa-datasource-property name="oracle.jdbc.V8Compatible">true</xa-
datasource-property>
-->
<exception-sorter-class-name>
org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
</xa-datasource>
I want to add the contents of data.txt before </xa-datasource>
string.