Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 1 down vote accepted
vim file +10d -c wq

or

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
1  
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

 
discard

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.