Text to XML conversion using script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Text to XML conversion using script
# 1  
Old 02-11-2011
Text to XML conversion using script

Hi
I have a file in the format with so many records
DB2 Universal JDBC Driver Provider,wdialdcsq,New JDBC Datasource,jdbc/wdialdcsq,,dcsqdb2n,cldrdgw1.is.chrysler.com,2998,DB2,10,1,180,0,1800
i need to convert all these into
<DataSource name="wdialODDC" maxConnection="10" minConnection="0 " connectionTimeout="10" agedTimeout="0" unusedTimeout="160" databaseName = "addcdb2p" description = "" portNumber = "" connectionAttribute = "cursorhold=0" loginTimeout = "0" enableMultithreadedAccessDetection = "false" />
# 2  
Old 02-12-2011
Parse input and use HERE template to make output.
Code:
out1()
{
echo $(<<EOF
<DataSource name="$a" maxConnection="$b" minConnection="$c " connectionTimeout="$d" agedTimeout="$e"
   unusedTimeout="$f" databaseName = "addcdb2p" description = ""
   portNumber = "$f" connectionAttribute = "cursorhold=0"
   loginTimeout = "0" enableMultithreadedAccessDetection = "false"
   now = "$(date '+%Y-%m-%d %H:%M:%S')"
/>
EOF
)
}


while IFS=,  read a b c d e f g h i j k l m n o p q r
do
        out1
done < filein > fileout

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

XML to Table conversion

<title>00000888</title> <name>XYZ</name> <updated>2397-2323</updated> <content>Content</content> <summary>summary12</summary> <title>00000788</title> <name>ABC</name> <updated>99090-09</updated> <content>Content123</content> ... (4 Replies)
Discussion started by: nanduri
4 Replies

3. 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

4. Shell Programming and Scripting

Shell or perl script to replace XML text in bulk

Hi, I am looking for assistance over shell or perl (without XML twig module) which replace string in XML file under particular branch..example of code file sample.. Exact requirment : Replace "Su saldo es" in below file with "Your balance" but only in XML branch of Text id=98 and Text Id=12... (7 Replies)
Discussion started by: Ashu_099
7 Replies

5. UNIX for Advanced & Expert Users

PDF to Text Conversion

Hi Guys, My OS is Suse Linux.. Is there a Command to convert PDF file to Text?? Cheers!!!!! (2 Replies)
Discussion started by: mac4rfree
2 Replies

6. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

7. Shell Programming and Scripting

shell or perl script needed for ldif file to text file conversion

This is the ldf file dn: sdcsmsisdn=1000000049,sdcsDatabase=subscriberCache,dc=example,dc=com objectClass: sdcsSubscriber objectClass: top postalCode: 29600 sdcsServiceLevel: 10 sdcsCustomerType: 14 givenName: Adelia sdcsBlackListAll: FALSE sdcsOwnerType: T-Mobile sn: Actionteam... (1 Reply)
Discussion started by: LinuxFriend
1 Replies

8. Shell Programming and Scripting

reading and searching xml element text in script

well i have this xml file here: this file is called filereader.xml <?xml version="1.0" encoding="UTF-8"?> <file> <file1> <filecopy>/new/test/thefile.txt</filecopy> <filecopy>/new/test/thefile2.ppt</filecopy> </file1> </file> i need to write the script that search for the Bold text... (2 Replies)
Discussion started by: forevercalz
2 Replies

9. Shell Programming and Scripting

reading and searching xml element text in script

well i have this xml file here: this file is called filereader.xml <?xml version="1.0" encoding="UTF-8"?> <file> <file1> <filecopy>thefile.txt</filecopy> <filecopy>thefile2.ppt</filecopy> </file1> </file> hi..i got this problem....hmm how do i write a... (6 Replies)
Discussion started by: forevercalz
6 Replies
Login or Register to Ask a Question