in reply to fastest pattern match
Untested
#!/usr/local/bin/perl use strict; open( FILE, "file" ) || die $!; while( <FILE> ) { if( /regexp/ ) { print; last; } }
or better yet ( also untested )
perl -ne 'print, last if /regexp/' file
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: fastest pattern match
by neilwatson (Priest) on Jun 24, 2002 at 19:43 UTC |