html tool

2020年11月12日星期四

sed 在指定行插入内容

 https://blog.csdn.net/u013299417/article/details/72900140

-----------------------------------------------------------------------

# sed -i "1i\time,input" indicator

# cat indicator

time,input

2020-11-13 11:02:42,0,0.13246,0,0.12823,0,0.114182

-----------------------------------------------------

原文:

用sed的i\命令在第一行前面插入即可,加上 -i 选项直接操作文件。

sed -i '1i\要添加的内容'  yourfile
查看插入第一行是否成功
sed -n '1,1p' yourfile

没有评论:

发表评论