Sed substitute recursively

前端 未结 6 874
我在风中等你
我在风中等你 2020-12-28 18:35

echo ddayaynightday | sed \'s/day//g\'

It ends up daynight

Is there anyway to make it substitute until no more match ?

6条回答
  •  青春惊慌失措
    2020-12-28 19:15

    Ok, here they're: while and strlen in bash. Using them one may implement my idea:

    Repeat until its length will stop changing.

    There's neither way to set flag nor way to write such regex, to "substitute until no more match".

提交回复
热议问题