Thursday, March 17, 2022

Re: Large file - Opening n head lines

Ni Va said on Thu, 17 Mar 2022 01:41:08 -0700 (PDT)

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

head -n 50 bigfile.txt | vim -
# NOTE: Save as bigfile.new
tail +51 bigfile.txt >> bigfile.new
# NOTE: bigfile.new is now your edited file.

If you do it often, you can put it in a shellscript, and can even
rename the original to .bak.

HTH

SteveT

Steve Litt
March 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm

--
--
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/20220317063748.7670a1c1%40mydesk.domain.cxm.

No comments: