in reply to Re^3: looking for speed!! large file search and extract
in thread looking for speed!! large file search and extract

A couple minor points (and maybe I'm a bit too new to PM to make the comments):

  1. You probably should have this in a new question, not a reply on the previous question, since it's now a new question.
  2. You probably should try something yourself, and then come back if it doesn't work. Or even if it does - share your answer and get feedback on it.
One WTDI is to use a simplified state machine:
my $match; while (<FH>) { print C $_ if $match and /^abcde.*PARTNAME$/; $match = /xyzdf$/; }
This will set $match to true if the current line matches xyzdf at the end, false otherwise. The next time through the loop, we only check your second-line regexp if $match is already true (that is, the previous line matched the other regexp).

Replies are listed 'Best First'.
Re^5: looking for speed!! large file search and extract
by Roy Johnson (Monsignor) on Jan 12, 2005 at 17:18 UTC
    It's not uncommon for people to modify their requirements. I think it belongs in the same thread as long as it's pretty close to the original problem.

    Caution: Contents may have been coded under pressure.