| Author |
sed - difference between -e and ;
|
|
| go2sai@gmail.com 2005-07-27, 5:55 pm |
| What is the difference between using multiple sed commands with -e
option and separating them by a ;
example
echo "sai" | sed -e 's/s/a/g' -e 's/a/i/g'
will result in iii
and
echo "sai" | sed 's/s/a/g;s/a/i/g'
will result in iii
| |
| Bill Marcum 2005-07-27, 5:55 pm |
| On 27 Jul 2005 08:04:24 -0700, go2sai@gmail.com
<go2sai@gmail.com> wrote:
> What is the difference between using multiple sed commands with -e
> option and separating them by a ;
>
> example
> echo "sai" | sed -e 's/s/a/g' -e 's/a/i/g'
> will result in iii
> and
> echo "sai" | sed 's/s/a/g;s/a/i/g'
> will result in iii
>
The only difference is that some versions of sed might not accept ;.
--
Tonight you will pay the wages of sin; Don't forget to leave a tip.
| |
| Michael Tosch 2005-07-27, 5:55 pm |
| Bill Marcum wrote:
> On 27 Jul 2005 08:04:24 -0700, go2sai@gmail.com
> <go2sai@gmail.com> wrote:
>
>
> The only difference is that some versions of sed might not accept ;.
>
>
A -e actually means a new line.
Some sed versions want labels on a separate line,
and branches at the end of a line:
echo sssai | sed -e ':l' -e 's/^s//;tl'
--
Michael Tosch @ hp : com
| |
| sai krishna 2005-07-28, 7:50 am |
|
Michael Tosch wrote:
> Bill Marcum wrote:
>
> A -e actually means a new line.
> Some sed versions want labels on a separate line,
> and branches at the end of a line:
>
> echo sssai | sed -e ':l' -e 's/^s//;tl'
>
>
> --
> Michael Tosch @ hp : com
can you please be little more elaborate..i didn't get what you meant..
Regards,
Sai Krishna
| |
| Geoff Clare 2005-07-28, 6:00 pm |
| Michael Tosch <eedmit@NO.eed.SPAM.ericsson.PLS.se> wrote:
[vbcol=seagreen]
[vbcol=seagreen]
> A -e actually means a new line.
> Some sed versions want labels on a separate line,
> and branches at the end of a line:
>
> echo sssai | sed -e ':l' -e 's/^s//;tl'
According to the standard (SUSv3) a semicolon isn't required to be
accepted after {, a, b, c, i, r, t, w, and : commands (and # comments),
or after an s command that has a w flag.
--
Geoff Clare <netnews@gclare.org.uk>
| |
| Michael Tosch 2005-07-28, 6:00 pm |
| sai krishna wrote:
>
> Michael Tosch wrote:
>
>
>
> can you please be little more elaborate..i didn't get what you meant..
>
> Regards,
> Sai Krishna
>
I mean these sed versions do not accept
echo sssai | sed ':l;s/^s//;tl'
--
Michael Tosch @ hp : com
| |
| sai krishna 2005-07-28, 6:00 pm |
| Thanx a lot for the replies..
Regards,
Sai Krishna
|
|
|
|