Click to See Complete Forum and Search --> : new bee in perl


guru_perl
01-25-2005, 03:17 PM
I have writen a small code inperl. but it is not working or i don't know how to write the code. I have a .log file and i want to read to log file first and remove the semicolon and then send that data to a new xml file.
here is an example of the log file

[1106148641] PROGRAM;1105974236;1002;1;1106148636;1106110800;1;1;1;1;0;1;1;0
[1106148641] HOST;7thday_Miami_INT_RTR;UP;1106143346;1105974236;0;0;0;0;0;0;1;1;1;1;0;0.00;0;1;1;PING OK - Packet loss = 0%, RTA = 61.58 ms
[1106148641] SERVICE;ALT_5940_Chicago;PING;OK;1/3;HARD;1106148388;1106148688;ACTIVE;1;1;1;1106148426;0;OK;174189;0;0;0;0;0;1;237;4;1;0;0.00;0;1;1;1; PING OK - Packet loss = 0%, RTA = 115.04 ms
[1106148641] SERVICE;ZM_PowerTrax_Router;PING;OK;1/3;HARD;1106148121;1106148421;ACTIVE;1;1;1;1106108106;0;OK;132924;0;0;0;0;0;1;219;6;1;0;0.00;0;1;1;1; PING OK - Packet loss = 0%, RTA = 117.88 ms

Nedals
01-27-2005, 01:44 AM
Is this log data on 1 line or multi-lines?
Where are the line breaks?.
What code have you already written?

The simple answer is....
You need to split on ';'. Then use a while loop to populate the xml