Re: Large file - Opening n head lines

2022-03-17 Thread Ni Va
Thank you all of you.

Le jeu. 17 mars 2022 à 19:24, Ni Va  a écrit :

> Thank you Steve i think you sum up the more efficient way. Thank you.
> Nicolas. 😉
>
> Le jeu. 17 mars 2022 à 11:38, Steve Litt  a
> écrit :
>
>> 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 a topic in the
>> Google Groups "vim_use" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/vim_use/jtqUuvOLZ5Y/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> vim_use+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/vim_use/20220317063748.7670a1c1%40mydesk.domain.cxm
>> .
>>
>

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAOKxv4HQ9a2os0BcTixD9Mgs12%3DZA2yyRjjvzgT_ynV65bp%2BSQ%40mail.gmail.com.


Re: Large file - Opening n head lines

2022-03-17 Thread Ni Va
Thank you Steve i think you sum up the more efficient way. Thank you.
Nicolas. 😉

Le jeu. 17 mars 2022 à 11:38, Steve Litt  a
écrit :

> 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 a topic in the
> Google Groups "vim_use" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vim_use/jtqUuvOLZ5Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/20220317063748.7670a1c1%40mydesk.domain.cxm
> .
>

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAOKxv4GPf2RD4J1noJ2wsXyf1TOa6XcZ-c3mzwpdX0nD0m3Amg%40mail.gmail.com.


Re: Large file - Opening n head lines

2022-03-17 Thread Ni Va
Thank you Charles. Many years i use your largefile.vim. Thank you Charles.
😊

Le jeu. 17 mars 2022 à 18:50, Charles Campbell  a
écrit :

> Stan Brown wrote:
> > On 2022-03-17 02:55, Lifepillar wrote:
> >> On 2022-03-17, Ni Va  wrote:
> >>> 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 ?
> >> I don't think that is possible with Vim without the help of some
> >> pre/post-processing tool, but... Vim can edit pretty large files
> >> relatively quickly, if set up properly. Have you tried playing with
> >> Vim's settings already?
> > What settings do you have in mind? I wasn't aware that Vim needed to be
> > set up differently for files of different sizes.
> >
> Vim doesn't "need" to be set up differently for large files. However,
> options can be selected to make it faster.
> See http://www.drchip.org/astronaut/vim/index.html#LARGEFILE for a
> plugin that helps with large files.
>
> Chip Campbell
>
> --
> --
> 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 a topic in the
> Google Groups "vim_use" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vim_use/jtqUuvOLZ5Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/177e85f5-d1a2-abd1-d2db-29e7b2fde5bf%40drchip.org
> .
>

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAOKxv4ETU8q98hQ4zFkVFw2WyGq0o_n2XiPjO98QNJe8A7EJQw%40mail.gmail.com.


Re: Large file - Opening n head lines

2022-03-17 Thread Ni Va
Sorry for late answer, that was to modify a 50Go VMware .vmdk file. Just to
modify disk space allocation. 😊

I tried this morning. Vim succeed to open but not to save and close.

NV

Le jeu. 17 mars 2022 à 18:50, Charles Campbell  a
écrit :

> Stan Brown wrote:
> > On 2022-03-17 02:55, Lifepillar wrote:
> >> On 2022-03-17, Ni Va  wrote:
> >>> 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 ?
> >> I don't think that is possible with Vim without the help of some
> >> pre/post-processing tool, but... Vim can edit pretty large files
> >> relatively quickly, if set up properly. Have you tried playing with
> >> Vim's settings already?
> > What settings do you have in mind? I wasn't aware that Vim needed to be
> > set up differently for files of different sizes.
> >
> Vim doesn't "need" to be set up differently for large files. However,
> options can be selected to make it faster.
> See http://www.drchip.org/astronaut/vim/index.html#LARGEFILE for a
> plugin that helps with large files.
>
> Chip Campbell
>
> --
> --
> 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 a topic in the
> Google Groups "vim_use" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vim_use/jtqUuvOLZ5Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/177e85f5-d1a2-abd1-d2db-29e7b2fde5bf%40drchip.org
> .
>

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAOKxv4E%2BEdO%3DHDqvjb9kE1kOVKE1Lo-ifraGVUXFLMQJ4OQJwg%40mail.gmail.com.


Re: Large file - Opening n head lines

2022-03-17 Thread Charles Campbell

Stan Brown wrote:

On 2022-03-17 02:55, Lifepillar wrote:

On 2022-03-17, Ni Va  wrote:

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 ?

I don't think that is possible with Vim without the help of some
pre/post-processing tool, but... Vim can edit pretty large files
relatively quickly, if set up properly. Have you tried playing with
Vim's settings already?

What settings do you have in mind? I wasn't aware that Vim needed to be
set up differently for files of different sizes.

Vim doesn't "need" to be set up differently for large files. However, 
options can be selected to make it faster.
See http://www.drchip.org/astronaut/vim/index.html#LARGEFILE for a 
plugin that helps with large files.


Chip Campbell

--
--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/177e85f5-d1a2-abd1-d2db-29e7b2fde5bf%40drchip.org.


Re: Large file - Opening n head lines

2022-03-17 Thread Stan Brown


On 2022-03-17 02:55, Lifepillar wrote:
> On 2022-03-17, Ni Va  wrote:
>> 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 ?
> 
> I don't think that is possible with Vim without the help of some
> pre/post-processing tool, but... Vim can edit pretty large files
> relatively quickly, if set up properly. Have you tried playing with
> Vim's settings already?

What settings do you have in mind? I wasn't aware that Vim needed to be
set up differently for files of different sizes.

-- 
Stan Brown
Tehachapi, CA, USA
https://BrownMath.com

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/0b5e7bdd-5d2f-f46d-23c4-8232de72de88%40fastmail.fm.


Re: Large file - Opening n head lines

2022-03-17 Thread Tim Chase
On 2022-03-17 01:41, Ni Va wrote:
> 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 ?

I don't think it's readily doable inside vim, but if I had such a
situation, I'd split it into the two portions like

  $ sed -n -e '1,50w head.txt' -e '51,$w tail.txt' bigfile.txt

I could then edit head.txt easily and write it back out.  I can then
recombine the pieces when done:

  $ cat head.txt tail.txt > edited_bigfile.txt

-tim




-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20220317070124.59ad6b1f%40bigbox.attlocal.net.


Re: Large file - Opening n head lines

2022-03-17 Thread M
чт, 17 мар. 2022 г. в 11:41, Ni Va :

> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/65df570f-36f5-415b-8b07-b4bda4f6n%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+unsubscr...@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.


Re: Large file - Opening n head lines

2022-03-17 Thread Steve Litt
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20220317063748.7670a1c1%40mydesk.domain.cxm.


Re: Large file - Opening n head lines

2022-03-17 Thread Lifepillar
On 2022-03-17, Ni Va  wrote:
> 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 ?

I don't think that is possible with Vim without the help of some
pre/post-processing tool, but... Vim can edit pretty large files
relatively quickly, if set up properly. Have you tried playing with
Vim's settings already?

Of course, all depends on what "large" and "quick" mean to you. And
I believe that the line length of the edited files is also an important
factor.

Life.

-- 
-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/t0v0i1%2416vt%241%40ciao.gmane.io.


Large file - Opening n head lines

2022-03-17 Thread Ni Va
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/65df570f-36f5-415b-8b07-b4bda4f6n%40googlegroups.com.