2023-02-08undefined0

sample.txt文件第1行前面添加“hello”;实质就是插入内容到文件第1行

sed -i '1 i hello' sample.txt

sample.txt文件第1行后面添加“hello”;实质就是插入内容到文件第2行

sed -i '1 a hello' sample.txt

把"hello"插入到第2行

sed -i '2i hello' sample.txt

把"hello"插入到最后一行

sed -i '$a hello' sample.txt

本文作者:墨洺的文档

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!