Will it work? open (TEST, "C:\\sample.log"); my $valcount=0; my $missvalue = 1; while (<TEST>) { if(/value : (\d+)/) { $val = $1; $val = $val - 1 if($val> 0);
if ($valcount != $val) { $valc = $valcount + 1 ; print "\nMissing $valc to ". $val; } $valcount=$1; } $valcount=0 if($valcount==255); } Let me know if it does not suit Thankyou VENU -----Original Message----- From: Sten Berg [mailto:[EMAIL PROTECTED] Sent: Thursday, April 15, 2004 7:01 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Missing sequence finder for logfiles Sorry! This is what I´ve come up with so far: my $nr=0; my @missing; open (FILE, "<logfile.txt") or die "Can't open $file: $!\n"; print "Started\n\n"; while (<FILE>) { ($firstbit, $value)=split /:/,$_; $value=trim ($value); if ($firstbit eq "- value ") { if ($nr==256) { $nr=0; print "New Sequence Started\n"; } if ("$value" ne "$nr") { print"read $value expected $nr\n"; push (@missing,"$nr-$value\n"); $nr = $value; } $nr++; } } print "missing ranges\n\n"; print for (@missing); close FILE; sub trim { my @out= @_; for (@out) { s/^\s+//; s/\s+$//; } return wantarray ? @out : $out[0]; } It would be nice though, to be able to give the log filename as a parameter to the perlscript. If the filename differs from time to time, it would be nice if I could avoid having the filename within the script. eplabi >From: James Edward Gray II <[EMAIL PROTECTED]> >To: "Sten Berg" <[EMAIL PROTECTED]> >CC: [EMAIL PROTECTED] >Subject: Re: Missing sequence finder for logfiles >Date: Thu, 15 Apr 2004 07:54:29 -0500 > >On Apr 15, 2004, at 7:08 AM, Sten Berg wrote: > >>Hi gurus! >> >>I´m looking for a way of analysing a log file and pinpoint missing >>sequences (foreach loop?). The logfiles looks something like this: >> >>LOGFILE >>- value : 0 >>some data... >>- value : 1 >>some data... >>- value : 2 >>some data... >>... >>... >>- value : 255 >>some data... >>- value : 0 >>some data... >>- value : 1 >>some data... >>... >> >>In other words; one loop stretches from 0-255 and then the next loop >>starts off att 0 again. I just want to know which values that are missing >>between 0-255 AND in which loop they were missing. >> >>I´m greatful if anyone can solve this :-) > >What have you tried? Where are you stuck? Show us some code. Help us >help you. > >James > > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] ><http://learn.perl.org/> <http://learn.perl.org/first-response> > > _________________________________________________________________ Lättare att hitta drömresan med MSN Resor http://www.msn.se/resor/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>