in reply to Reading a pattern and a number of lines after it
As in:perl -ne '$x=/ou/..0; print if $x && $x-1 <= 3' data.dat
Notice how it prints the matching line plus an additional $numlines lines...% cat data.dat one two thrtestee four five six werwr werwer seen? % perl -ne '$x=/ou/..0; print if $x && $x-1 <= 3' data.dat four five six werwr
-Blake
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reading a pattern and a number of lines after it
by simon.proctor (Vicar) on Jan 09, 2002 at 05:13 UTC |