We export “records” to an xml file; one of our customers has complained that the file is too big for their other system to process. Therefore I need to split up the file,
As mentioned already the xml_split
from the Perl package XML::Twig does a great job.
xml_split < bigFile.xml
#or if compressed e.g.
bzcat bigFile.xml.bz2 | xml_split
Without any arguments xml_split
creates a file per top-level child node.
There are parameters to specify the number of elements you want per file (-g
) or approximate size (-s <Kb|Mb|Gb>
).
Look here
sudo apt-get install xml-twig-tools