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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.