0

I am trying to replace & using chr(38)using sed but I keep getting error.

 cat line.txt -- Partners & Customers

 sed  's/&/' || chr(38) || '/g' line.txt

I get below error.

 -bash: syntax error near unexpected token `38'  

I tried escaping ( and ) but it didn't help.

Regards.

user2854333
  • 640
  • 6
  • 20
  • 1
    You're trying to put two singlequotes _within_ a shell token defined by singlequotes. For this case (though not in general) you can use doublequotes: `"s/&/' || chr(32) || '/g"` – dave_thompson_085 Sep 09 '21 at 06:11
  • 2
    Does this answer your question? [How to escape single quote in sed?](https://stackoverflow.com/questions/24509214/how-to-escape-single-quote-in-sed) – Wiktor Stribiżew Sep 09 '21 at 09:13

0 Answers0