How do I split a large xml file?

后端 未结 7 1996
小鲜肉
小鲜肉 2021-01-02 14:05

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,

相关标签:
7条回答
  • 2021-01-02 14:39

    As mentioned already the xml_split from the Perl package XML::Twig does a great job.

    Usage

    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>).

    Installation

    Windows

    Look here

    Linux

    sudo apt-get install xml-twig-tools

    0 讨论(0)
提交回复
热议问题