I am a complete stranger to PERL and need some valuable help
Here is my problem
I need to copy a file from ftp serv开发者_JS百科er A and place the file into ftp server B When doing this i need to read that file contents and split that big file by matching the pattern of open and ending tags combination and create individual small files and place them in destination ftp server B.
For example if the file name is 20100921.xml and if sample has below format
<?xml version="1.0" encoding="utf-8" ?>
<parent>
<child>
<code></code>
<text></text>
</child>
<child>
<code></code>
<text></text>
</child>
</parent>
In the original XML there are lot of child tags instances; i will need to make separate files whose contents will be the ones between tags. In this case there will be 2 new files to be created. Individual file names could be like 20100921_1.xml
Everyday there will be only 1 file and the file name will have current date.
Can anyone help me with PERL that can do the above. Thanks a lot.
You can use xml_split for this, probably something like xml_split -l 1 -b 20100921 big.xml
.
xml_split comes with XML::Twig, so it is indeed in Perl, which doesn't really matter, unless you want to extract the relevant code from the tool and include in yours.
精彩评论