sed replace single/double quoted text?

后端 未结 4 1256
南旧
南旧 2021-02-04 06:11

Having some difficulty in replacing some single/double quoted text with sed and was wondering what\'s the correct method for these 2 examples

to change

4条回答
  •  独厮守ぢ
    2021-02-04 06:34

    You'll have to use hex escapes, for example, to do those replacements.

    $ echo "'foo'" | sed 's/\x27foo\x27/\x27bar\x27/'
    'bar'
    

    You could also use octal escapes: \o047 (that's a lower-case "Oh") or decimal escapes: \d39.

提交回复
热议问题