in reply to Quick version of "first record" to "last record" ?

Here's how I would do it, since I don't have that module installed, and I'm lazy:
  perl -ne 'if (/valid/) { print; exit }' < data
  tac data | perl -ne 'if (/valid/) { print; exit }'
"tac" is reverse "cat".
  • Comment on Re: Quick version of "first record" to "last record" ?

Replies are listed 'Best First'.
Re^2: Quick version of "first record" to "last record" ?
by perlcapt (Pilgrim) on Oct 18, 2004 at 12:32 UTC
    I had never heard of 'tac' before. Way cool. It even exists on Cygwin! I'll be using the Module, but nonetheless adding tac to my *nix vocabulary. Thanks. -ben