How to replace to apostrophe ' inside a file using SED

后端 未结 4 1428
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 21:46

I have a file \"test.txt\" that contain the following

+foo+
+bar+

What I want to do is to replace them into:

\'foo\'
\'bar\         


        
4条回答
  •  轮回少年
    2020-12-15 22:49

    You can also replace all instances of + with ' in the file by using tr:

    tr '+' "'" < inputfile
    

提交回复
热议问题