On Tue, Nov 22, 2011 at 16:40, Joerg Schilling
<joerg.schill...@fokus.fraunhofer.de> wrote:
> 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?
>

# sed --help

Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

----- >8 snip

  -r, --regexp-extended
                 use extended regular expressions in the script.

----- >8 snip


Rgds,
-- 
FdS Pandu E Poluan
~ IT Optimizer ~

 • LOPSA Member #15248
 • Blog : http://pepoluan.tumblr.com
 • Linked-In : http://id.linkedin.com/in/pepoluan

Reply via email to