I have a file larger than 5 GB. Are there any programs/tools that will be able to open it and copy & paste the contents?

If not, can it be done by writing a program?

link|improve this question
1  
What operating system? And yes, it can be done. – yodaj007 Nov 24 '11 at 4:51
Copy & paste? What part, exactly? If it's all of it, you can copy the file. – minitech Nov 24 '11 at 4:52
Whats the Operating System ? The very fact that its created a 5gb file means that it support a large file. What error do you receive while trying to open the file ? – Kevin Nov 24 '11 at 4:53
possible duplicate of Text editor to open big (giant, huge, large) text files – Samuel Liew Nov 24 '11 at 5:03
feedback

migrated from stackoverflow.com Nov 24 '11 at 7:51

This question came from our site for professional and enthusiast programmers.

3 Answers

If not, can it be done by writing a program?

Yes, it can be better to use this approach if the operation is something you will have to do often.

There are many scripting tools that are well suited to this sort of task. One of them is Perl. Perl is included in most Linux & Mac systems and available free for Windows

Example: "copy" all text between and including lines starting "Apple…" and "Orange…" from file1.txt and "paste" (actually append) it to the end of file2.txt

perl -ne "print if /^Apple/../^Orange/" file1.txt >> file2.txt

The above can be typed at a command prompt. The part between quotes is the program (or script).

link|improve this answer
feedback

You can use text editors which can handle large text/binary files.

I recommend:

Also, see possible duplicate question:

Text editor to open big (giant, huge, large) text files

link|improve this answer
Please explain how you'd handle big files in Notepad++. In my experience, it can't. Not really. – Daniel Beck Nov 24 '11 at 7:56
feedback

If you only want to do is copy and paste or do some small edits then I suggest using linux/unix text processing tools such as grep, sed, tail etc. They can easily find relevant part of the file or can modify it.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown