The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 02-23-2006
ReV ReV is offline
Registered User
 

Join Date: Jun 2005
Posts: 34
Creating file contents using contents of another file

Hi,

I am not sure how to start doing this so I hope to get some advice as to how to start.

I have 2 files. The source file contains data that I needed is in columns delimited by ";". For example, in this format:

Code:
"CONTINENT","COUNTRY","CITY","ID"
"asia","japan","tokyo","123"
"europe","germany","munich","456"
"africa","eygpt","cairo","789"
The output format is in xml format and the contents is something like:

Code:
<?xml version="1.0"?>
<!DOCTYPE ALR [
        <!ENTITY gt "&amp;gt;">
        <!ENTITY lt "&amp;lt;">
        <!ENTITY quot "&amp;quot;">
]>
<datafile>
        <info ID="#id should be here#">
                <info1>#continent name should be here'</info1>
                <info2> </info2>
                <info3>#country name should be here#</info3>
                <info4>#city name should be here#</info4>
                <info5>some fixed data</info5>
                <info6> </info6>
                <info7> </info7>
                <info8>some fixed data</info8>
                <info9>some fixed data</info9>
                <info10>some fixed data</info10>
                <info11>some fixed data</info11>
        </info>
        <action>
                <attributes>
                        <attributkey id="011" >N</attributkey>
                        <attributkey id="106" >N</attributkey>
                        <attributkey id="114" >N</attributkey>
                        <attributkey id="119" >N</attributkey>
                                        </attributes>
                <comment> </comment>
        </action>
</datafile>
There should be one output file created for each line in the source file.

Anyone can help? Thanks a lot!
Reply With Quote
Remove advertisements
!!
Forum Sponsor