DesperatePerler has asked for the wisdom of the Perl Monks concerning the following question:
But sometimes the log-file has some irregular lines:Line2-16042010083153^Sistema Monitoraggio Centauro^01032491^^^2GbNLLGN +mMK1wpPt2HLxCXXW8DmWc5V6JQSk7wZNdq6NnGmlXGnJ!-1562333788!127139950109 +2
I have to manage these irregular situations so in output I'll have just one line (merge Line3 and Line4). This is the code of my script:Line3-16042010084016^Rete Prova Centauro^01032491^Analisi giornaliera +Mensile^dataFinale = 13/04/2010|tecnica = ITALTEL|livelloImpianto = 1 +|dataIniziale = 13/04/2010|direzioneTraffico = |livelloOLOFascioITC = + 2|iqSoglia = 0.05|livelloFascioITC = 3|areaTerritoriale = PV|impiant +iSel = |livelloDirezioneTraffico = 4|oloFascioITCSel = |livelloQuarto +Dora = 5|action = agmDrillDownData^2GbNLLGNmMK1wpPt2HLxCXXW8DmWc5V6JQ +Sk7wZNdq6NnGmlXGnJ!-1562333788!1271399501 Line4-92
Thanks in advance for the help!!!!while($line=<STDIN>){ chomp($line); if($line=~/^\d{14}^.*^.*^.*^.*^\Z([^\d+!\d+])/){ print $line."\n"; } else { $line2=<STDIN>; chomp($line2); print "$line$line2\n"; redo; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: STDIN Log Parser
by toolic (Bishop) on Jul 13, 2010 at 15:44 UTC | |
|