Adding characters at the start and end of each line in a file

后端 未结 4 987
抹茶落季
抹茶落季 2021-01-30 02:32

What is the best way to add some characters at the start and end of each line? Can it be done using Vim, or some other way?

4条回答
  •  春和景丽
    2021-01-30 03:03

    better util would be sed (especially if you need to script it)

    cat foo.txt | sed s/^\(.*\)$/"\1"/g
    

提交回复
热议问题