About XML file Integrating to a table


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users About XML file Integrating to a table
# 1  
Old 05-24-2009
About XML file Integrating to a table

Hi ,
I have a question about unix shell scripting. I hope someone may help me to solve problem. In our system , there are two server that generate two different log file which are XML format in UNIX system. The problem is ,
this XML files contain such counter names and values sometimes this counter names and values are get out of order. We don't have any permission to change counter names order.
So, when I integrate that file into a table in oracle, column names and values are different because of disorder.
How I can load this file to my table without of disorder?
Could you please share the solution suggestions with me?

the example of XML file ;
There are two server and we get this xml files from two servers .
these are the names of the counter names;
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
.
.
.
the problem is ;
In one xlm file, first counter name is Attempts from first server however first counter name is Successful Attempts in second server. In order to integrate these fields to oracle table there is inconsistency with column names and values .
Thanks a lot
catherine
# 2  
Old 05-24-2009
To ensure that the "Attempts" line counter is always "1" and the "Successful Attempts" line counter is always "2" you could run each xml file through the following script before importing it into Oracle:

Code:
 sed -e '/Attempts/s/mt p="2"/mt p="1"/' -e '/Successful Attempts/s/mt p="1"/mt p="2"/'   inputfile.xml > outputfile.xml

Example run thorugh:
Code:
$ cat inputfile.xml
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
<mt p="2">Attempts</mt>
<mt p="1">Successful Attempts</mt>
<mt p="2">Attempts</mt>
<mt p="2">Successful Attempts</mt>
<mt p="1">Attempts</mt>
<mt p="1">Successful Attempts</mt>
$ sed -e '/Attempts/s/mt p="2"/mt p="1"/' -e '/Successful Attempts/s/mt p="1"/mt p="2"/' inputfile.xml > outpufile.xml
$ cat outpufile.xml
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
<mt p="1">Attempts</mt>
<mt p="2">Successful Attempts</mt>
$

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to load XML file to Oracle table

Experts. I have created a oracle table as below. create table xml_tab ( File_No number , File_content Varchar2(2000), file_type xmltype ); Daily we are receiving many XML files as below. here is our sample xml file. File1 : (7 Replies)
Discussion started by: vasuvv
7 Replies

2. Shell Programming and Scripting

Splitting a single xml file into multiple xml files

Hi, I'm having a xml file with multiple xml header. so i want to split the file into multiple files. Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix. eg : <?xml version="1.0" encoding="UTF-8"?> <ml:individual... (3 Replies)
Discussion started by: Narendra921631
3 Replies

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

4. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

5. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

6. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

7. Shell Programming and Scripting

How to export table data to xml file?

Hi , I would like to get some suggestion from the experts. My requirement is to export oracle table data as an xml file. Any unix/linux tools, scripts available? Regards, (2 Replies)
Discussion started by: LinuxLearner
2 Replies

8. Programming

about wave file integrating.

Now I have two wave file(*.wav) at Tru64 Unix machine. I want to make a new wave file including the two wave file. how I should finish this programmer. If you know, can you give me the format of the wave file(*.wav) and Sun au file(*.au). Thank you. (1 Reply)
Discussion started by: livic
1 Replies
Login or Register to Ask a Question