Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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


In reply to Re: bootlog.txt shrinker by a
in thread bootlog.txt shrinker by dmckee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (10)
    As of 2015-07-30 09:45 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (270 votes), past polls