I am using this snippet code (just delete first line with ed). I wanna know if i can make something like this in vim. I wrote the script and passed the file as an argument.
file:
# This is a comment #
foo bar
edit with ed:
ed $1 << EOF
1/^[ ]*$/d
w 
q
EOF
I tried with vim:
vi $1 << EOF
dd
w 
q
EOF
> Vim: Warning: Input is not from a terminal
小智 6
You can start vim in 'ex' mode and feed it the commands:
vim -E -s yourfile <<EOF
:1d
:update
:quit
EOF
But it would be more appropriate just to use sed in this case:
sed '1d' yourfile
| 归档时间: | 
 | 
| 查看次数: | 589 次 | 
| 最近记录: |