I have a text file that is very large. It has only one line which is
of the form like below.
itemA itemB itemC ......

Basically itemA, itemB etc are character strings of some arbitrary
length and they are separated by a space.

I wanted to modify the file so that each line will have only one item.
The next item after a certain item will be placed in the next line. So
this is fairly easy with a ":s/ /\r/g" command. The problem is when I
have about a million of such items, this takes very long. It was going
on for about two hours and then I killed the vim session. Then I tried
to achieve the same result writing a small perl script (using split),
and I was surprised that it took less than 10 seconds to finish.

Why such a huge difference in the time taken by two methods? Any
comments? Any way I could have made things faster in the vim method?

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to