Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

in vim, with

vim file +10

I can open the file in the line 10, with

vim file +10d

I can delete the line 10, but how I can delete the line and exit of vim? or how I can delete the line without open vim ?

share|improve this question
up vote 1 down vote accepted
vim file +10d -c wq


vim file +10d -c x

vim --help

 -c <command>        Execute <command> after loading the first file
share|improve this answer

To do that it would be better to use sed like this:

sed -i 10d file
share|improve this answer
but, I like use the vim commands – juanpablo Jun 7 '12 at 15:03
you can execute multiple commands, but it will always open vim and then close. i suggested sed because you said "without open vim". vim file -c 10d -c x – johnshen64 Jun 7 '12 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.