bug-sed
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31781: I apologize it's not the right place, but I need answer


From: Assaf Gordon
Subject: bug#31781: I apologize it's not the right place, but I need answer
Date: Tue, 12 Jun 2018 03:04:21 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]