[HRPM] multiline match!!

Collin Cusce cusce at jlab.org
Tue Mar 13 14:30:54 CST 2001


Whoops! I should have read your question better. Here's my appended answer:
<code>
    $count = 1;
    $string =  "";
    @entries = ();
    @result = ();
    while($line = YOURFILE){
        if ($count % 2){
            $string =  "";
            $string .= $line;
        }else{
            push(@entries, $string);
        }
    $count++;
    }
    foreach $entry (@entries){
        ($date_id, $explanation)= split(/\n/, $entry);
        ($thisdate, $idstring) = split(/\s+/, $date_id);
        $thisid =~ /\d+/;
        $max = @result;
        @result[$max] = {
                "id" => $thisid,
                "date" => $thisdate,
                "explanation" => $explanation
       }
    }
</code>
I hope  this is what you were looking for...I know I this can't be the best
way to do this, but I'm too lazy to look for a better solution :-P .
(P.S.: This is untested...regard it as pseudo-code)
            Collin Cusce'
----------------------------------------------------------------------------
Sir Humpherey Applebee once said:
Well Minister, if you asked me for a straight answer then I shall say that,
as far as we can see, looking at it by and large, taking one time with
another, in terms of the average of departments, then in the final analysis
it is probably true to say that, at the end of the day, in general terms,
you would find, that, not to put too fine a point on it, there probably
wasn't very much in it one way or the other, as far as one can see, at this
stage.
----------------------------------------------------------------------------



----- Original Message -----
From: "Santiago Nieva" <sgalayar at yahoo.com>
To: <norfolk-pm-list at happyfunball.pm.org>
Sent: Tuesday, March 13, 2001 2:27 PM
Subject: [HRPM] multiline match!!


> Hi everybody,
> I failed this morning trying to filter a log that has
> "two line entries" like this:
>
> 2001-03-07 msgID=4875876856     <--- line with date,
> hour
> User "nnnnnn" does not exists   <--- explanation text
> 2001-03-07 msg.....
> The applica....
>
> What I wanna do is to get the "pair" filtered by date
> and explantion text. p.e collect all entries with date
> "xxxx" and text "not exists".
> Thnaks in advance
> santi
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - Buy the things you want at great prices.
> http://auctions.yahoo.com/
>




More information about the Norfolk-pm mailing list