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!

Convert xml file to table 2

Status
Not open for further replies.

DzzSqrd

Technical User
Sep 1, 2008
3
DE
Hi there!

I have a log file in which every line looks like this:

2008-08-25 14:43:20 <?xml version="1.0" encoding="UTF-8" standalone="no"
?><ROSIS:rosisprot xmlns:zbd><request_id>1</request_id>
<frequence>40</frequence><dunkel>500</dunkel><spektral>100</spektral>
<nadir>100</nadir><dunkel_winkel>216</dunkel_winkel>
<spektral_winkel>829</spektral_winkel><nadir_winkel>79</nadir_winkel>
<dunkel_motor>-3109</dunkel_motor><spektral_motor>-11931</spektral_motor>
<nadir_motor>-1138</nadir_motor><disk_space>18822209</disk_space>
<output_file>emtpty val-001.dat</output_file><comment>emtpty val</comment>
<error_code>0</error_code><error_message></error_message></ROSIS:rosisprot>


And I would like to convert this to a table. Any hints how to start?

Thanks!
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Well, I tried to find the values by searching with e.g. /<dunkel>/,<\/dunkel>, but I did not find out how to read out the value.
 
You could just strip out the XML tags using:

Code:
sed 's/<[^>]*>//g'

...and what you're left with looks nearly like a table. :)

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top