Some amendment of the data in txt file. I have tried the suggested code but Im not successfully write it again in the txt file with this format.I've tried the collection.sort but it write the data in long line.
My txt file contain these data:
Monday
Jessica Run 20mins
Alba Walk 20mins
Amy Jogging 40mins
Bobby Run 10mins
Tuesday
Mess Run 20mins
Alba Walk 20mins
Christy Jogging 40mins
Bobby Run 10mins
How can I sort those data in ascending order and store it again in txt file after sorting?
Monday
Alba Walk 20mins
Amy Jogging 40mins
Bobby Run 10mins
Jessica Run 20mins
Tuesday
Alba Walk 20mins
Bobby Run 10 mins
Christy Jogging 40mins
Mess Run 20mins
Jessica Run 20mins