Adding content of a text file to middle of other text file before a particular string
You can do it using sed insert with bash command substitiution
sed "/<\/xa-datasource>/i $(<inputFile.txt)" file1.txt
this way text from inside inputFile.txt will be inserted in line preceeding </xa-datasource>
If you want it to be inserted before the given string but in the same line, you can use sed substitution instead of insert:
sed "s/<\/xa-datasource>/ $(<inputFile.txt)<\/xa-datasource>/" file1.txt
with the second way, you are replacing matched string with the new one, so you must include it at the end the replacement string
Some people prefer to use backtics ''
instead of $()
due to portability reasons, but I prefer second form if it is for bash only as it looks more readable for me