Nice. Always wondered what was important in that file,
however a
couple of things: seems like you're doing more work than
needed (why the "not eof( ..." as opposed to while ($readline = <BOOTLOG>)
but then I ended up needing the $readline to get your
exact output.) and going through the entire @aok each line is
slower. I thought a snazzy RE would help, but I ended up w/:
#!/usr/bin/perl -w
use strict;
my ($readline,$found);
my %aok=("Loading Vxd" => 1, # A list of all the different
+ values
"LoadSuccess" => 1, # that should be ignored. Oth
+ers are
"Loading Device" => 1, # left in for debugging purpo
+ses.
"LoadSuccess" => 1,
"SYSCRITINIT" => 1,
"SYSCRITINITSUCCESS" => 1,
"DEVICEINIT" => 1,
"DEVICEINITSUCCESS" => 1,
"Dynamic init device " => 1,
"Dynamic init success" => 1,
"Dynamic load device " => 1,
"Dynamic load success" => 1,
"Initing" => 1,
"Init Success" => 1,
"INITCOMPLETE" => 1,
"INITCOMPLETESUCCESS" => 1,
"LoadStart" => 1,
"Init" => 1,
"InitDone" => 1,
"Status" => 1,
);
my $debug = 0;
open BOOTLOG, "<C:\\bootlog.txt" or die ("Error: could not open c:\\bo
+otlog.txt\n$!\n"); # Open up the file
while (<BOOTLOG>) {
my $readline = $_;
chomp;
my ( $key, $val);
s/^\[\w*\]\s*//; # ditch the [A000134] junk for ease of splitting
if ( /=/ ) {
# lines w/ '=' have just 2 parts
( $key, $val ) = split(/\s+=\s+/);
} else {
# lines w/o '=' are key words ... value; e.g. value is the last word
(my @key_val ) = split(/ /);
$val = pop @key_val;
$key = join " ", @key_val;
}
print "$readline" unless ($aok{$key}); # Check against %aok if its i
+gnorable; if not, print.
#print "$key = $val\n" unless ($aok{$key}); # if don't care about th
+e "[mem addr]" part
}
Not as nifty as it could be but faster.
a |