Web lists-archives.com

Re: [Mingw-msys] Reconstruction of MSYS-1.0.11 test results - sh-utils.




Greg Chicares a écrit :
> On 2008-06-27 18:49Z, SUNIL NEGI wrote:
>> While compiling libiconv on msys environment, I found the following line
>> throws an error:
>>
>> snegi1@xxxx ~/dlds/libiconv-1.12
>> $ echo "1.12" | sed -n -e "/^[0-9]/{s/^\([0-9]*\).*/\1/p;q}"
>> sed: -e expression #2, char 32: Extra characters after command
[snip]
>> $ sed --version
>> GNU sed version 3.02
> 
> is just too old. I get the same error if I put the command
> in a file and invoke it with 'sed -f'. You can try writing
> the command a little differently; e.g., this seems okay:
> 
> echo "1.12" | sed -n -e "/^[0-9]/s/^\([0-9]*\).*/\1/p"
> 
> and I don't see why anyone would write 'q' here anyway.

Because the writer wants to stop on the first match. It is logical to 
get only one major version number.

An alternative is:
echo "1.12" | sed -n -e "/^[0-9]/s/^\([0-9]*\).*/\1/p" | head -n 1

-- 
Michael


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys