in reply to grab only if pattern matches previous line
This assumes that the data stream is a series of records that all start with "request(" and have line breaks as indicated in your example (because /(.*)/ does not match a new-line character). But if your data varies from that a bit, it might still be pretty easy to adapt this idea to handle it.{ local $/ = "request("; # change the input record separator while (<>) { if ( /^(.+)\s+START_TIME, (.*)/ and $1 ne "BADSTRING" ) { print "$1:$2\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: grab only if pattern matches previous line
by rje (Deacon) on Jul 10, 2003 at 15:20 UTC |