WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: FW: sed command grouping brace match problem

Re: sed command grouping brace match problem

by Davide Brini :: Rate this Message:

| View in Thread

On Wed, 20 Jun 2012 22:53:14 +0000, "Caldwell, David (Overwatch Systems)"
<dcaldwell@...> wrote:

> I saw no evidence that my email to
> bonzini@...<mailto:bonzini@...> had any effect, so now I'm trying
> the email address in the sed --version output.
>
> David
>
> From: Caldwell, David (Overwatch Systems)
> Sent: Friday, June 15, 2012 7:43 PM
> To: 'bonzini@...'
> Subject: sed command grouping brace match problem
>
> Hi,
>
> I'm using Cygwin with sed version 4.2.1.
>
> I can't get command grouping to work with both the open & closing braces
> on the same line when one of the commands is "r filename": sed '/pattern/
> { N; N; r fileToInsert }'

That is by design. You have to use either

sed -e '/pattern/ { N; N; r fileToInsert' -e '}'

or a real newline, ie

sed -e '/pattern/ { N; N; r fileToInsert
}'


--
D.

 « Return to Thread: FW: sed command grouping brace match problem