Editor for working with large files

Hi,

We have file which is about 756 MB of size and vi/vim do not work when we try to edit this file. I'm looking for any editor ( ok if its NOT free ) which has the ability to open/edit a file of 1+GB seamlessly. The OS is SUN Solaris 10 ( Sparc )

Thanks in Advance
Maverick

What messages do you get from vi?

Is it a space issue?

If so, then this is because the temporary file it creates has to reside somewhere and the default is /var/tmp If that filesystem is not big enough then it will fail to open the file as you expect. You can re-direct the temporary file by editing your .exrc and including the following directive:-

set dir=/test/temp

.... or to wherever you have sufficient free space.

Of course, I've never tried to open such a huge file as a few hundred Mb, so this is not guaranteed to work!

I hope that it helps though.

Robin
Liverpool/Blackburn
UK

I have done what you have mentioned and it still gives me the same message

Tmp file too large

However, the default directory /var/tmp has about 59 GB of free space.

What do you need from the file? If it's just browsing to confirm something, then more will suffice. If you really need to edit and save the result, you may need to split the file up, edit the required part and then reassemble it.

If it's data, perhaps you need some code to do the edit. You might get away with a sed for a single line if you can work out which line you need to change.

Can you tell us more about what your objective is and someone may be able to suggest more options for you.

Robin

Hi.

I agree with the sentiment of rbatte1 -- what are you trying to do?

There are some additional tips at How to edit multi-gigabyte text files? Vim doesn't work =( - Stack Overflow including an anecdote from someone who edited a 44 GB file.

Best wishes ... cheers, drl

1 Like

To view/navigate in the file, I would suggest to use less , which has many all the vi commands outside those that change the file content.
To modify the file, I would use either sed or nawk .

I would say a paid option is also good in this case. This is needed by people who are NON-IT so it would be good if we had an editor rather than sed/awk script.Any suggestions on a non free editor ( for Sparc solaris)

I in such cases ask the users to copy the file on their PC and get a ultraedit license...
(worked so far hehe)

Perhaps you need to split up the file into chunks that vi can manage then. If they need to edit it, then concatenate the pieces back together again when they are done. You could do something like this:-

mkdir /tmp/$$
split -dl 10000 source_file /tmp/$$/
vi /tmp/$$/*
cat /tmp/$$/* > source_file
rm -r /tmp/$$

It's pretty crude and you would need a temporary directory with sufficient space, I admit, but it might help.

If they are non-IT, then perhaps the vi editor is not for them though. Would you consider a Samba share that they can map from a PC and therefore use an editor of their choice? The only worry then is if someone chooses to save in a document format rather than plain text.

Robin

I doubt there is a market for a commercial text editor able to edit +1GB text files while there are undoubtedly freewares able to do it.
What kind of text files are these ?
What kind of editing commands are expected ?

what you want is pico or nano.

vi is for masochists.

vim -n file

does not use a swap file.

2 Likes

I'm for vi then. You have to be a masochist to like working here.....

"vim" is generally not installed on Solaris 10, only a standard conforming "vi" with no "-n" option.