Re: lines matching N and N+1
Jim Hill <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <CAEE75_17G+-SBTR1TbVG1Y_2XROYcbXvC3oqCrhbDY5bphKx0g@mail.gmail.com> |
Aaaand of course that won't work with the foo... foo ... bar sequence.
sed -r '/<foo>/!{p;d}
: n
$!N
/<foo>(.*\n.*)<bar>/FOO\1BAR/ {s//FOO\1BAR/;p;d}
/\n.*<foo>/!{p;d}
P; s/.*\n//
t n
'
On Wed, Jan 30, 2013 at 3:48 PM, Jim Hill <[email protected]> wrote:
> How about
>
> sed -r '/<foo>/!{p;d}; $!N; s/<foo>(.*\n.*)<bar>/FOO\1BAR/'
>
>
[Non-text portions of this message have been removed]