Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new in perl pls tell how to rearrange the merge file
I want change the arrangement like file4.xml, file2.xml,file3.xml & file1.xml
sample files:

file1.xml
<merge_file1.xml>

heading1


<author>first author
sdasdasda

<!--page 1-->



<interaction-entry>


<agent>Methadone<!--page 2-->


<image src="filename-001.tif">
</style> <link
Diagram 1 any text</image>
<bar>
<effect id="fdf">'May <!--page 4-->increase ˵ methadone.foorrr clearance
<action>'Monitor patient' for ¡ withdrawal symptoms.
<!--page 5-->
<body> barlish </body>)
<image src="filename-003.tif">
<heading>
<p_ph4>Indications #997mh and dosages<!--page IV-->
<author>second author
<action>barted )<!--page V-->
<style name="supscrpt">0</style>
<style name="supscrpt">o</style>
</link> <link>
</link><link>




file2.xml
<merge_file2.xml>

heading1


<author>first author
sdasdasda

<!--page 1-->



<interaction-entry>


<agent>Methadone<!--page 2-->


<image src="filename-001.tif">
</style> <link
Diagram 1 any text</image>
<bar>
<effect id="fdf">'May <!--page 4-->increase ˵ methadone.foorrr clearance
<action>'Monitor patient' for ¡ withdrawal symptoms.
<!--page 5-->
<body> barlish </body>)
<image src="filename-003.tif">
<heading>
<p_ph4>Indications #997mh and dosages<!--page IV-->
<author>second author
<action>barted )<!--page V-->
<style name="supscrpt">0</style>
<style name="supscrpt">o</style>
</link> <link>
</link><link>




file3.xml
<merge_file3.xml>

heading1


<author>first author
sdasdasda

<!--page 1-->



<interaction-entry>


<agent>Methadone<!--page 2-->


<image src="filename-001.tif">
</style> <link
Diagram 1 any text</image>
<bar>
<effect id="fdf">'May <!--page 4-->increase ˵ methadone.foorrr clearance
<action>'Monitor patient' for ¡ withdrawal symptoms.
<!--page 5-->
<body> barlish </body>)
<image src="filename-003.tif">
<heading>
<p_ph4>Indications #997mh and dosages<!--page IV-->
<author>second author
<action>barted )<!--page V-->
<style name="supscrpt">0</style>
<style name="supscrpt">o</style>
</link> <link>
</link><link>




file4.xml
<merge_file4.xml>

heading1


<author>first author
sdasdasda

<!--page 1-->



<interaction-entry>


<agent>Methadone<!--page 2-->


<image src="filename-001.tif">
</style> <link
Diagram 1 any text</image>
<bar>
<effect id="fdf">'May <!--page 4-->increase ˵ methadone.foorrr clearance
<action>'Monitor patient' for ¡ withdrawal symptoms.
<!--page 5-->
<body> barlish </body>)
<image src="filename-003.tif">
<heading>
<p_ph4>Indications #997mh and dosages<!--page IV-->
<author>second author
<action>barted )<!--page V-->
<style name="supscrpt">0</style>
<style name="supscrpt">o</style>
</link> <link>
</link><link>


Posted
Comments
Mehdi Gholam 19-Nov-11 1:28am    
It is unclear what you require, please edit your question and supply more information.
Uilleam 21-Nov-11 1:06am    
I presume this has something to do with your earlier question. In that code you simply open the directory and take the XML files in their native order. If you want a specific order, you are going to have to tell Perl that order, it can't guess. Is there something in the files' contents that determine the order? If so, then you would need to open each one and determine the order, then do the merge after. If the order is simply your own list of files, then put that in an array, and have Perl loop through that. If you can explain more about what you're trying to do you will get better answers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900