How to replace to apostrophe ' inside a file using SED

linux, sed, unix

Solution

Use `"` instead. And add `g` flag to replace all.

sed  "s/\+/\'/g" test.txt

Problem

I have a file "test.txt" that contain the following ``` +foo+ +bar+ ``` What I want to do is to replace them into: ``` 'foo' 'bar' ``` But why this code doesn't work? ``` sed 's/\+/\'/' test.txt ``` What's the right way to do it?

Original source