On 11/22/2011 10:40 AM, Joerg Schilling wrote:
>> Here's an alternative:
>>
>> sed -r -e 's/-[0-9].*//'
> 
> Nust a note: sed has no option -r and 's/(.*)-[0-9].*/\1/' is a "garbled" 
> command. A corrected version would be 's/\(.*\)-[0-9].*/\1/'
> 
> So the main question is: why do you use a non-existing option? 
> 

It does (at least, sys-apps/sed-4.2.1-r1 does):

       -r, --regexp-extended

              use extended regular expressions in the script.

Appendix A Extended regular expressions
***************************************

The only difference between basic and extended regular expressions is in
the behavior of a few characters: `?', `+', parentheses, and braces
(`{}').  While basic regular expressions require these to be escaped if
you want them to behave as special characters, when using extended
regular expressions you must escape them if you want them _to match a
literal character_.

-------------------------
I just learned something new....

raf

Reply via email to