Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Editing contents of a file with the contents of another file

Status
Not open for further replies.

omoo

Programmer
May 30, 2005
87
US
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:

"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:

<?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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top