Pandu Poluan wrote:
> >> 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
>
> Usag
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-e
On Tue, Nov 22, 2011 at 16:40, Joerg Schilling
wrote:
> Pandu Poluan wrote:
>
>> On Tue, Nov 22, 2011 at 10:26, Adam Carter 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? :-)
>>
Pandu Poluan wrote:
> On Tue, Nov 22, 2011 at 10:26, Adam Carter 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
> >
> >
On Tue, Nov 22, 2011 at 10:26, Adam Carter 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.i
> I'd use sed and the regex "-[0-9]" to delimit the field
>
>
> foo=`echo '123--bad-2xyz-3--' | sed -r -e "s/-[0-9].*//"`
> echo $foo
> 123--bad
>
>
> Helpful?
Perfect - thanks!
On 11/21/2011 06:52 PM, Adam Carter wrote:
> Hi All,
>
> I need to cut a string, which happens to be a filename, using the
> first dash that's followed by a numeral, so cut -f 1 -d"-" fails if
> the filename has an extra dash. How do i do this?
Here's a Bourne parameter expansion:
blee@eclipse ~
Oh, and you can get the other end next by
foo2=`echo '123--bad-2xyz-3--' | sed -r -e "s/$foo//"`
echo $foo2
-2xyz-3--
Joseph Davis wrote:
I'd use sed and the regex "-[0-9]" to delimit the field
foo=`echo '123--bad-2xyz-3--' | sed -r -e "s/-[0-9].*//"`
echo $foo
123--bad
Helpful?
Adam Cart
I'd use sed and the regex "-[0-9]" to delimit the field
foo=`echo '123--bad-2xyz-3--' | sed -r -e "s/-[0-9].*//"`
echo $foo
123--bad
Helpful?
Adam Carter wrote:
Hi All,
I need to cut a string, which happens to be a filename, using the
first dash that's followed by a numeral, so cut -f 1 -d"
>> 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
Hi All,
I need to cut a string, which happens to be a filename, using the
first dash that's followed by a numeral, so cut -f 1 -d"-" fails if
the filename has an extra dash. How do i do this?
11 matches
Mail list logo