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>




Reply via email to