I've been working on a piece of code that splits a file containing multiple XML files into individual XML files. The line count of each XML file varies so I have been using the XML head tag to know where the next file starts.
grep -n $string $xmlfile | sed -n 's/^\([0-9]*\)[:].*/\1p' Which gets me the line number of the start of each file. How can I use the head/tail command to make use of the line numbers to pull the files apart within a single automated script?