How to escape the ampersand character while using sed

前端 未结 3 1481
囚心锁ツ
囚心锁ツ 2020-12-30 07:25

I want to replace all single quotes in a string with two single quotes using sed. But when the string contains the & character, the sed command is not repla

3条回答
  •  旧巷少年郎
    2020-12-30 07:46

    It's easier to answer if you post your code, but I'm guessing you're not escaping the ampersand. Change & to \& if you want a literal ampersand.

    See section 3.1.2 of The sed FAQ for a more detailed explantion, if you're curious.

提交回复
热议问题