How to enclose every line in a file in double quotes with sed?

后端 未结 4 1563
鱼传尺愫
鱼传尺愫 2021-02-02 09:21

This is what I tried: sed -i \'s/^.*/\"$&\"/\' myFile.txt

It put a $ at the beginning of every line.

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 10:05

    You almost got it right. Try this slightly modified version:

    sed 's/^.*$/"&"/g' file.txt
    

提交回复
热议问题