Gentoo Archives: gentoo-user

From: Joerg.Schilling@fokus.fraunhofer.de (Joerg Schilling)
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] sed/awk question
Date: Tue, 22 Nov 2011 10:07:09
Message-Id: 4ecb73d5.97Ou4PA7rdTuxnp1%Joerg.Schilling@fokus.fraunhofer.de
In Reply to: Re: [gentoo-user] sed/awk question by Pandu Poluan
1 Pandu Poluan <pandu@××××××.info> wrote:
2
3 > >> sed -r -e 's/-[0-9].*//'
4 > >
5 > > Nust a note: sed has no option -r and 's/(.*)-[0-9].*/\1/' is a "garbled"
6 > > command. A corrected version would be 's/\(.*\)-[0-9].*/\1/'
7 > >
8 > > So the main question is: why do you use a non-existing option?
9 > >
10 >
11 > # sed --help
12 >
13 > Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
14 >
15 > ----- >8 snip
16 >
17 > -r, --regexp-extended
18 > use extended regular expressions in the script.
19 >
20 > ----- >8 snip
21
22 You seem to miss the fact that you are using gsed instead of sed.
23
24 using -r makes scripts non-portable.
25
26 Jörg
27
28 --
29 EMail:joerg@××××××××××××××××××××××××.de (home) Jörg Schilling D-13353 Berlin
30 js@××××××××××××.de (uni)
31 joerg.schilling@××××××××××××××××.de (work) Blog: http://schily.blogspot.com/
32 URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily

Replies

Subject Author
[gentoo-user] Re: sed/awk question Nicolas Sebrecht <nsebrecht@×××××.fr>