
在 vim 中,與
vim file +10
我可以在第 10 行開啟該文件
vim file +10d
我可以刪除第10行,但是如何刪除該行並退出vim?或如何在不開啟 vim 的情況下刪除該行?
答案1
vim file +10d -c wq
或者
vim file +10d -c x
vim--幫助
-c <command> Execute <command> after loading the first file
答案2
為此,最好使用sed像這樣:
sed -i 10d file