lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Mingw-msys] Reconstruction of MSYS-1.0.11 test results - misc.
- Date: Wed, 2 Jul 2008 13:05:10 -0500
- From: "SUNIL NEGI" <SUNIL.NEGI@xxxxxxxxxxxxxxx>
- Subject: ***BOGO*** Re: [Mingw-msys] sed on msys error
Thanks a lot for the detailed explanation Michael.
Removing the 'q' just before the right hand brace seems to have done the trick for me.
The expression:
$ echo "1.12" | sed -n -e "/^[0-9]/{s/^\([0-9]*\).*/\1/p;}"
Works just fine on msys now...
Thanks again.
Sunil
-----Original Message-----
From: mingw-msys-bounces@xxxxxxxxxxxxxxxxxxxxx [mailto:mingw-msys-bounces@xxxxxxxxxxxxxxxxxxxxx] On Behalf Of Michael DOUBEZ
Sent: Wednesday, July 02, 2008 3:35 AM
To: mingw-msys@xxxxxxxxxxxxxxxxxxxxx
Subject: Re: [Mingw-msys] sed on msys error
Keith Marshall a écrit :
> [SNIP]
> In fact, the original expression,
> appearing in the sed command above, is invalid, and while some sed
> implementations may forgive it, MSYS sed correctly rejects it.
>
> Note the placement of the right hand brace, in the above expression;
> it is immediately preceded by the `q' action verb, but POSIX is very
> explicit here:--
> http://www.opengroup.org/onlinepubs/009695399/utilities/sed.html
> | [2addr] {function
> | function
> | ...
> | }
> | Execute a list of sed functions only when the pattern space is
> | selected. The list of sed functions shall be surrounded by braces
> | and separated by <newline>s, and conform to the following rules.
> | The braces can be preceded or followed by <blank>s. The functions
> | can be preceded by <blank>s, but shall not be followed by
> | <blank>s. The <right-brace> shall be preceded by a <newline> and
> | can be preceded or followed by <blank>s.
>
> (note the explicit requirement for a *newline*, and *nothing* *else*,
> preceding the right brace).
[SNIP]
> IMHO, this is a classical example of clever misuse of an inappropriate
> tool, leading to a fragile implementation; (and in this case it's so
> fragile, that the breakage is built in from the outset). [SNIP]
Version 4.1.1 of sed does accept the expression and, unless I am
mistaken, there is no mention of the newline requirement in the info pages.
http://www.gnu.org/software/sed/manual/html_node/Common-Commands.html
|`{ COMMANDS }'
| A group of commands may be enclosed between `{' and `}' characters.
| This is particularly useful when you want a group of commands to
| be triggered by a single address (or address-range) match.
It is a bug depending on whether you use a POSIX sed or a GNU sed.
--
Michael
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys