I have 2 GB file with 10 million lines. Is anyway to sort the file content without loading the full file content into memory
Jump to Post
You 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
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.