FW: sed command grouping brace match problem

View: New views
3 Messages — Rating Filter:   Alert me  

Parent Message unknown FW: sed command grouping brace match problem

by Caldwell, David (Overwatch Systems) :: Rate this Message:

| View Threaded | Show Only this Message

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 }'

Attached is a script that reproduces the problem.

David


reproduceBug (936 bytes) Download Attachment

Re: sed command grouping brace match problem

by Davide Brini :: Rate this Message:

| View Threaded | Show Only this Message

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.


Re: FW: sed command grouping brace match problem

by Paolo Bonzini-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Thu, Jun 21, 2012 at 12:53 AM, 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.

bonzini@... was (and is :)) on vacation and tries to read email as
sparingly as possible. :)  Thanks Davide for following up.

Paolo