0

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 ?

3
vim file +10d -c wq

or

vim file +10d -c x

vim --help

 -c <command>        Execute <command> after loading the first file
1

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

sed -i 10d file
  • 1
    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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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