Re: print specific line (by address) within a block of text
"Brian J. Murrell" <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On 12-12-12 05:14 PM, Davide Brini wrote:
>
> Assuming that /d/ *always* starts a block, and omitting some nitpicks
> that perhaps are unlikely to be important, you could do
>
> sed -n '/d/{n;n;p;}'
Ahh, nice. What if the offset into the block can be variable, from only
a few lines to maybe a few dozen lines, so some way to give "n" a number
of iterations. I have taken notice of the looping abilities of sed but
have not come across any way to control loop iteration count with
numerical values.
Cheers,
b.
[Non-text portions of this message have been removed]