1 |
On Tue, Nov 22, 2011 at 16:40, Joerg Schilling |
2 |
<Joerg.Schilling@××××××××××××××××.de> wrote: |
3 |
> Pandu Poluan <pandu@××××××.info> wrote: |
4 |
> |
5 |
>> On Tue, Nov 22, 2011 at 10:26, Adam Carter <adamcarter3@×××××.com> wrote: |
6 |
>> >>> sed -r -e 's/(.*)-[0-9].*/\1/' |
7 |
>> >> |
8 |
>> >> You know, that looks familiar... are you trying to get a package name from |
9 |
>> >> the list of eix-installed? :-) |
10 |
>> > |
11 |
>> > No - its non-gentoo. In this case it hasn't worked |
12 |
>> > |
13 |
>> > $ echo net-snmp-5.3.2.2-5.cp843034001.i386.rpm | sed -r -e 's/(.*)-[0-9].*/\1/' |
14 |
>> > net-snmp-5.3.2.2 |
15 |
>> > |
16 |
>> |
17 |
>> Ah, yes. sed's greedy regex again messes up the plan >.< |
18 |
>> |
19 |
>> Here's an alternative: |
20 |
>> |
21 |
>> sed -r -e 's/-[0-9].*//' |
22 |
> |
23 |
> Nust a note: sed has no option -r and 's/(.*)-[0-9].*/\1/' is a "garbled" |
24 |
> command. A corrected version would be 's/\(.*\)-[0-9].*/\1/' |
25 |
> |
26 |
> So the main question is: why do you use a non-existing option? |
27 |
> |
28 |
|
29 |
# sed --help |
30 |
|
31 |
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]... |
32 |
|
33 |
----- >8 snip |
34 |
|
35 |
-r, --regexp-extended |
36 |
use extended regular expressions in the script. |
37 |
|
38 |
----- >8 snip |
39 |
|
40 |
|
41 |
Rgds, |
42 |
-- |
43 |
FdS Pandu E Poluan |
44 |
~ IT Optimizer ~ |
45 |
|
46 |
• LOPSA Member #15248 |
47 |
• Blog : http://pepoluan.tumblr.com |
48 |
• Linked-In : http://id.linkedin.com/in/pepoluan |