On Mon, 23 Dec 2019 23:09:28 +0100, Chewbaka Roskov <address@hidden>
wrote:
akem@akem-HP:~$ echo '112233' | sed 's/2*//' ### DOESN'T WORK
112233
You're asking for "zero or more twos". At the beginning of the string (and
between each pair of characters) there is indeed a zero-length match for
your regexp, which sed duly replaces with nothing as you asked. Had you
replaced with something or used the /g switch to the "s" command, you'd
have seen it. For example:
$ echo '112233' | sed 's/2*//g'
1133
$ echo '112233' | sed 's/2*/XXX/'
XXX112233