Hi Hernan,

First I would like to say please start using perl instead of system calls.
This makes life a lot easier, I know I did it as well, but try to find solutions
for you system calls :

open (FH, "< logprueba.log")
@logprueba = <FH>;
close FH;

Now you can start filtering :

foreach $pruebalog(@logprueba) {
  ($ip, $setuptime, disconnectime) = (split /\s+/ $pruebalog)[4,7,9]
  push @allips, $ip;
  ...
  ..
}

Of course you can also do this while you have your FH open :

open (FH, "< logprueba.log")
  while <FH> {
    ($ip, $setuptime, disconnectime) = (split /\s+/ $_)[4,7,9] ## or leave $_
    push @allips, $ip;
    ...
    ..
  }
close FH;

I think you were not waiting for such an answer, but I think you have to start
somewhere to get familiar with perl.

I don't get the real question excactly, but I think as soon as you use this method
you can easily find the solution yourself. If not please let us know and I will
definitly see if I can help. And else we have some real guru's who can solve
it all :)  (Come on Feelix)

Hope to have been of a little service. Feelix can adjust my $mistakes.


Regs David

> 
> Hello all i am parsing a cisco cdr log and i am having some problems to
> create the adecuate regexp
> 
> the log goes like this
> 
> May 16 08:03:58  10.0.0.1   38#00155544446, SetupTime 11:06:31.062
> DisconnectTime 11:10:06.922
> May 16 08:03:58  10.0.0.1   38#00155544446,SetupTime 11:06:31.062
> DisconnectTime 11:10:06.922
> May 17 08:03:58  10.0.0.1   38#00155544446, SetupTime 11:06:31.062
> DisconnectTime 11:10:06.922
> May 17 08:03:58  10.0.0.1   38#00155544446,SetupTime 11:06:31.062
> DisconnectTime 11:10:06.922
> 
> 
> The script goes like this
> 
> $VOIP = 'cat logprueba.log | egrep
> --regexp=%VOIPAAA-5-VOIP_CALL_HISTORY|cut -f6 -d " "';
> 
> system('cat log1.log | egrep --regexp=PeerAddress| cut -f10 -d " "| sed
> -e s/38#//g > /var/log/parsed');
> 
> $dialednumber='sed -e s/,//g /var/log/parsed';
> 
> 
> >From this script i get the dialed number,setup time and disconnect
> time,now i have got
> to repeat this to analize the entire log,i was thinking in a foreach
> loop to look for
> a repetitive pattern(like %VOIPAAA-5-VOIP_CALL_HISTORY) and repeat the
> parsing for
> each ocurrence of the pattern.
> 
> any sugestions?,any known script that does that?,maybe some software
> like mrtg,webmin allready does that(anyone knows)?
> 
> i am sorry for the long mail,thanks in advance
> Hernan
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to