How to escape plus sign on mac os x (BSD) sed?

前端 未结 4 1102
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 00:42

I\'m trying to find and replace one or more occurrences of a character using sed on a mac, sed from the BSD General Commands.

I try:

echo \"foobar\"          


        
4条回答
  •  旧巷少年郎
    2020-12-06 01:06

    Sed is sad for regexes. You could either try the -E, which might work with BSD, or you could try this one instead:

    sed -e "s/o\{1,\}/"
    

    Perhaps there are too many sed's out there to have a usable tool on any system.

提交回复
热议问题