I am trying to do external sort right now and I am running into problems. I can sort chunks of a really huge text file and place them into separate smaller files, but I am having a problem figuring out how to sort them. I have an idea of just reading the first word of each smaller file and compare to see which one is smaller and output that word to a final file, then implement to read the 2nd word from that smaller file compare to the first words of the remaining smaller files and so on. Ultimately the final file would have all sort words from these smaller files. The main problem is I am not sure what kind of method I should use to read the files in this manner. I originally used scanner but scanner doesn't keep a pointer or what I have read once I leave the loop, can someone please help.
I am doing a similar project.
By the way I my smaller files are only separated by spaces, so I cant use readline either.