Pandu Poluan <pa...@poluan.info> wrote:

> On Tue, Nov 22, 2011 at 10:26, Adam Carter <adamcart...@gmail.com> wrote:
> >>> sed -r -e 's/(.*)-[0-9].*/\1/'
> >>
> >> You know, that looks familiar... are you trying to get a package name from
> >> the list of eix-installed? :-)
> >
> > No - its non-gentoo. In this case it hasn't worked
> >
> > $ echo net-snmp-5.3.2.2-5.cp843034001.i386.rpm | sed -r -e 
> > 's/(.*)-[0-9].*/\1/'
> > net-snmp-5.3.2.2
> >
>
> Ah, yes. sed's greedy regex again messes up the plan >.<
>
> 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? 

Jörg

-- 
 EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       j...@cs.tu-berlin.de                (uni)  
       joerg.schill...@fokus.fraunhofer.de (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

Reply via email to