sed rare-delimiter (other than & | / ?…)

后端 未结 8 2109
傲寒
傲寒 2020-12-17 17:42

I\'ve to apply the Unix command sed on a string (can contain #, !, /, ?, &, @ and all other characters) which can contains all types of

8条回答
  •  时光说笑
    2020-12-17 18:32

    Wow. I totally did not know that you could use any character as a delimiter. At least half the time I use the sed and BREs its on paths, code snippets, junk characters, things like that. I end up with a bunch of horribly unreadable escapes which I'm not even sure won't die on some combination I didn't think of. But if you can exclude just some character class (or just one character even)

    echo '#01Y $#1+!' | sed -e 'sa$#1+ashita' -e 'su#01YuHolyug'

    > > > Holy shit! That's so much easier.

提交回复
热议问题