GNU bug report logs -
#31781
I apologize it's not the right place, but I need answer
Previous Next
Reported by: Budi <budikusasi <at> gmail.com>
Date: Sun, 10 Jun 2018 22:59:01 UTC
Severity: normal
Tags: notabug
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #12 received at 31781-done <at> debbugs.gnu.org (full text, mbox):
tags 31781 notabug
close 31781
stop
Hello,
On 10/06/18 04:58 PM, Budi wrote:
> How to use SED command(s) that will replace the shell's pipe command in
> order to perform more efficient, e.g:
>
> echo abcde | sed -r 's/cd/XX/' | sed 's/[^x]/z/ig'
>
> become far more efficient and compact, might be look like this,
>
> echo abcde | sed -r 's/cd/XX/ {N: s/ ........... }
>
> ( ...so on. That's what I am asking for )
>
> both will give the same result zzXXz
>
The portable way is to use multiple "-e" parameters:
$ echo abcde | sed -e 's/cd/XX/' -e 's/[^x]/z/ig'
zzXXzz
That should work on all sed, not just gnu sed.
When using GNU sed, you can specify multiple commands
separated by semicolons:
$ echo abcde | sed 's/cd/XX/ ; s/[^x]/z/ig'
zzXXzz
I'm closing this item but discussion can continue by replying
to this thread.
regards,
- assaf
This bug report was last modified 6 years and 340 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.