replacing strings with newlines : sed

Hi everyone,

Since the previous time I received help from unix.com I have been encouraged to learn more.

going through 1 of the articles(View Article) on sed I found, it pointed an interesting situation.
Suppose the text is :

Romeo and Ethel the Dancer Moves Audience to Tears.
I was treated to the off Broadway opening of Romeo and Ethel the
Dancer. This moving story of star-crossed lovers had the
audience in tears half way through the third act.
Do not go to see this play without a hanky, but even the weeping
from the back row could not diminish the brilliance of Romeo and
Ethel the Dancer by William Shakespeare.

Now I want to replace "Romeo and Ethel the Dancer" by "Romeo and Juliet".
The lines are separated by newlines.

The article demontrates doing this by using addresses. I was trying to think of another way round by building a reg-ex and use simple sed.
I believe I need a way to represent a newline in the sed search expression.

Please help by hinting towards the solution and not directly.

Thank You.

Regards

One approach might be to replace all new-line characters with a different character. Perhaps

tr "\n" "~" would turn the text into one long string

Or have a look into sed's abilities for multiline pattern (N).

Thanks for the options, I ll try these out and get back to you.:slight_smile:

Regards