开发者

PERL script required transfer xml file from 1 FTP server to another, split into small files [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜