Thanks John Little-4, and to everyone else that helped.
I appreciate all of your suggestions.

tr -d '\n' <old_file >new_file 

seems to have worked best for me out of the suggestions I've tried so far.

Also, thank you Christian for the benchmark results. They were very helpful
=^D


John Little-4 wrote:
> 
> 
> On Jul 28, 10:19 am, drlatex <[email protected]> wrote:
>> I have a gigantic file (millions of lines long), and I want to make it
>> all
>> one line.  There is ONE \n at the end of every line.
> 
> IMO vim is line oriented, and unwieldy with megabytes all in one
> line.  I can imagine one wanting to do it after working on the file in
> vim, but in that case using a tool outside vim could work well:
> 
> tr -d '\n' <x >y
> tr '\n' ' ' <x >z
> 
> take less than 2 seconds on my PC for x having 8,295,474 lines,
> totalling 200 MB, with x obviously all in cache.  ( tr is an ancient
> unix programme, but one can get Gnu utils for windows.)  My vim (7.2
> on ubuntu)  takes 14 s to load x, but doesn't cope at all with y or z.
> 
> Regards, John
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/better-way-to-remove-%5Cn-tp24688299p25115986.html
Sent from the Vim - General mailing list archive at Nabble.com.


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

Reply via email to