in reply to Log File Parsing

well, i am Mr. Read-Binary-Data-in-Perl-using-Pack-and-unpack, but sometimes you do not have the spec, or it cannot be reverse engineered (easily). I tend to use open(FH,"command |") instead of back ticks, so i would do something more like (untested code ahead):
#!/usr/bin/perl -w use strict; my @data = (); $/ = '------------------------------------------------------------\n'; open(PIPE,'ulread |') || die "could not fork() : $!\n"; while (my $line = <PIPE>) { ## total block push @data, $line } close(PIPE) || die "close error : $!\n"; for(1..4){ pop @data; }

speling champ of tha claz uf 1997
-- MZSanford

Replies are listed 'Best First'.
Re: Re: Log File Parsing
by TStanley (Canon) on Sep 11, 2001 at 19:44 UTC
    What I basically need to know is how to go about parsing the information from the records themselves, once I get the information read into the array. An idea that came to me was to make an array of hashes, with each hash being a single record. I then could go through each hash, looking for a specific value in the date, putting those records into a separate array, then printing out that array, but I am not quite sure how I would go about doing that.

    TStanley
    --------
    There's an infinite number of monkeys outside who want to talk to us
    about this script for Hamlet they've worked out
    -- Douglas Adams/Hitchhiker's Guide to the Galaxy