Plz Help To convert xml file to text file using bourn shell scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Plz Help To convert xml file to text file using bourn shell scripts
# 1  
Old 11-09-2005
Plz Help To convert xml file to text file using bourn shell scripts

If someone out there could help me out with this problem. I would really appreciate it.

I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts.

My xml file:

<root>

<header_rec recordtype="00">
<record_id>00</record_id>
<country_code>AK></country_code>
</header_rec>

<detail_rec recordtype="01">
<record_id_01>01</drecord_id>
<country_code_01>AK</country_code>
</detail_rec>

<detail_rec rectyp_2="10">
<record_id>10</record_id>
<country_code>AK</country_code>
<fax>4567677</fax>
</detail_rec>

<trailer_rec recordtype="99">
<record_id>99</record_id>
</trailer_rec>

</root>





My File Test.txt


00AK112005-08-15 (record type=00)(fixed lengths -->recordid:1-2 -->countrycode:5-7


012005-65AK2005-08-15 (record type=01)
012005-65AK2005-08-15 (record type=01)
012005-65AK2005-08-15 (record type=02)
012005-65AK2005-08-15 (record type=02)

99AK11392005-08-+0000424 (record type=99))




I can't use whitespace as a delimiter.


Thanks you guys very much,
I really appreciate it.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

How to write in other language in text/xml file by reading english text/xml file using C++?

Hello Team, I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file. Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies

2. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

3. Shell Programming and Scripting

Need help to write a shell script to convert text file to excel file.

Hi Everyone, I want your help to write a script which will take text file as input and on the basis of delimiter ":"script will create excel sheet. Example input: IpAdress:InstanceName:Port:ServerName 10.255.255.1:abc:2232:xyz_abc Output should be an excel sheet like below: Column... (8 Replies)
Discussion started by: akabhinav18
8 Replies

4. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

5. Shell Programming and Scripting

How to convert xml file to text file?

Hi Everyone, I want to convert 1 xml file to text file.... Please help in the xml file i have 4 columns.... Thanks a lot in advance. Nilesh (6 Replies)
Discussion started by: nileshbhawsar
6 Replies

6. Shell Programming and Scripting

Convert XML to Data File in Shell Script

Hi All, I will be getting a huge XML file with a lot of records in it. I need to convert it into multiple data files. SAMPLE XML FILE <ABSProductCatalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <ProductSalesHierachy> - <Portfolios> - <Portfolio productCode="P1"> ... (8 Replies)
Discussion started by: ragha81
8 Replies

7. Shell Programming and Scripting

Convert XML file into TEXT file using PERL seript

Dear Yogesh..."Convert XML file into TEXT file using PERL seript"... can u help me regarding this issue...plz Thanks Rudro (0 Replies)
Discussion started by: Rudro
0 Replies

8. Shell Programming and Scripting

convert XML file into Text file(fixed length)

If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts. My xml file: <root> <header_rec recordtype="00"> <record_id>00</record_id> ... (0 Replies)
Discussion started by: ram2s2001
0 Replies

9. Shell Programming and Scripting

Converting Text File into XML using Unix Shell Scripts

Hi everyone, If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert a file into xml format using Unix shell scripts. The file has fields with each field having a certain number of bytes, but the fields are not delimited by anything... (10 Replies)
Discussion started by: Laud12345
10 Replies
Login or Register to Ask a Question
TV_SORT(1p)						User Contributed Perl Documentation					       TV_SORT(1p)

NAME
tv_sort - Sort XMLTV listings files by date, and add stop times. SYNOPSIS
tv_sort [--help] [--by-channel] [--output FILE] [FILE...] DESCRIPTION
Read XMLTV data and write out the same data sorted in date order. Where stop times of programmes are missing, guess them from the start time of the next programme on the same channel. For the last programme of a channel, no stop time can be added. Tv_sort also performs some sanity checks such as making sure no two programmes on the same channel overlap. --output FILE write to FILE rather than standard output --by-channel sort first by channel id, then by date within each channel. --duplicate-error If the input contains the same programme more than once, consider this as an error. Default is to silently ignore duplicate entries. The time sorting is by start time, then by stop time. Without --by-channel, if start times and stop times are equal then two programmes are sorted by internal channel id. With --by-channel, channel id is compared first and then times. You can think of tv_sort as converting XMLTV data into a canonical form, useful for diffing two files. EXAMPLES
At a typical Unix shell or Windows command prompt: tv_sort <in.xml >out.xml tv_sort in.xml --output out.xml These are different ways of saying the same thing. AUTHOR
Ed Avis, ed@membled.com perl v5.14.2 2006-03-02 TV_SORT(1p)