Thursday, March 17, 2022

Re: Large file - Opening n head lines


чт, 17 мар. 2022 г. в 11:41, Ni Va <nivaemail@gmail.com>:
Hi All,

Is it possible to open a Large File Vim but just only few beginning lines of it, edit one of these 50 first lines and then save and quit ?

Thank you
NV

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/65df570f-36f5-415b-8b07-1111b4bda4f6n%40googlegroups.com.

Inserting data, in general case (i.e. if the size may change), is non-trivial. That is, one has to append a copy of the original file's tail and then flush everything to disk again.So even if you do

    :read !head -n 20 foobar.txt

and edit it, you still must do

    :saveas temp
    :!tail -n +21 foobar.txt >>temp
    :!mv temp foobar.txt

to create a new version. And it does not look like some gain to me.

Regards,
Matvey

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAFsTB%2BJYqMwD%2Bv2LdJ4xg4YDUpa_6VTNYxPNQC-TnSMbw3Qriw%40mail.gmail.com.

No comments: