My file contains data which is not well idented. Say like:
<?xml version="1.0" encoding="UTF-8" ?><ns0:collection
xmlns:ns0="http://namspace/Service/1.0"><Record>
.
.</Record></ns0:collection>
I have to marge file N number of such files and create one file. So I need the following to be done:
- I need to remove only
</ns0:collection>closing tag from the first file - remove both
<?xml version="1.0" encoding="UTF-8" ?><ns0:collection xmlns:ns0="http://namspace/Service/1.0">and</ns0:collection>in the next (n-1) files - Have to remove only
<?xml version="1.0" encoding="UTF-8" ?><ns0:collection xmlns:ns0="http://namspace/Service/1.0">in the last file and merge all of them together
I have tried using sed command to process first file which is not resulting anything, "merged.xml" is empty.
sed '/<\/ns0:collection>/d' $file1 > merged.xml
Any suggestions?
Recordnodes