Suppose there is one file1.txt where content is written
Ramesh
Suresh
Raman
From the below shell script ,I am reading the content name from file1 .txt and preparing the Name=$line in echo statement.(Not able to show in shell script,in line 3 of sh it is written.
while read -r line
do
echo "<Name="$line"/>"
done <"file.txt"
There is another xml file2.xml
<project>
<target>
start
end
</target>
</project>
I want to enhance my shell script which will insert lines to file2.xml. If in file2.xml, we find pattern end, then insert the content above end , each in new line. Can anyone please help in modifying the shell script.
Output should look like:-
<project>
<target>
start
Name=Ramesh
Name=Suresh
Name=Raman
end
</target>
</project>