Hi,
I have 2 GB file with 10 million lines. Is anyway to sort the file content without loading the full file content into memory
macla
0
Newbie Poster
Recommended Answers
Jump to PostYou probably need to use a merge-sort algorithm. Read the file in small chuncks, sort them, then write each chunk into its own file. When that is done you might wind up with 10-15 files, depending on the size of each chunck read. After that, open all the files at …
All 3 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.