在文档中添加一行:
在指定行前面添加
sed -i '/2/i\here' test.txt
在指定行后面添加
sed -i '/2/a\after the line' test.txt
在最后面添加
sed -i '$a\last line' test.txt
在文档中添加一行:
在指定行前面添加
sed -i '/2/i\here' test.txt
在指定行后面添加
sed -i '/2/a\after the line' test.txt
在最后面添加
sed -i '$a\last line' test.txt