On Fri, Jun 20, 2008 at 09:06, Pat Rice <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I am looking at a way of reading a line doing a regex to find the
> specific line then pick out the line, sudo code would be some thing
> like the following:
>
> read in line
> check regex
>
> if regex is correct
> {    jump 10 lines
>    print the output
> }
>
> any ideas on jumping the 10 lines, how do I ignore the lines in the
> file, and know I'm going the right distance ?
snip

while (<>) {
    if (/regex/) {
        <> for 1 .. 9; #throw away nine lines
        my $line = <>; #get the tenth line
        print $line;
    }
}

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to