I have a .csv file that is ordered in a certain way. I want to reorder it by another field. Your ideas would be much appreciated.
I only have to do this once, not multiple times, so performance is not too much of an issue.
What I am thinking.
If I just create an object (java) to hold each of the fields and then create an ArrayList of these objects. I will then order the ArrayList on the field I want (I can order an ArrayList of objects based on one member of the object – right?), and print this reordered ArrayList to a .csv file.
Souds like it would work but is also some overkill. If you have a unix box or cygwin you could just do
This will break the fields up by , and sort by the field number
sorts by the second field.