Thuy Tran wrote:
>
> Hi all,
Hello,
> I would like to prints a specified number of lines from a file that after
> any line match a specified regular expression (ex. UID)
>
> open(FILE, 'data' ) or die "can't open";
> if start ! = UID
> skip line;
> else
> read 100 lines below UID
> end if
>
> __data__
> Nov 2002 Page 1
>
> UID CPU_PRIME #SESSION
> 0 2 0
> 1 3 0
> ......
open FILE, 'data' or die "can't open 'data': $!";
my ( $start, $end );
while ( <FILE> ) {
$start = $. + 1, $end = $. + 101 if /UID/;
print if $. == $start .. $. == $end;
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]