howdthattaste
Programmer
hello,
maybe its just me, (well im pretty sure its just me) but i'm having a hard time trying to figure out the best way to sort a particular text file.
sample race data:
(name,sex,state,secs)
Sally,female,indiana,26,23443
Mike,male,ohio,23,23423
Jim,male,indiana,29,12355
etc...
so lets say the complete data had almost every state present and ages 20 - 29 with a mix of boys/girls. i want to sort by: state, age, sex, seconds, name. Sure in excel, this is easy, but additionally, i want to export only the top in each category to a file. (basically the winners to a file).
so the results like:
Alabama, 29, Female, [time], [name]
Alabama, 29, Male, [time], [name]
Alabama, 28, Female, [time],[name]
etc..
so there might be 80,000 racers, but i only need the top in each category. However, i want to throw in that maybe no females age 23 from Maine participated. so there would be no line in the output file for that. (so yeah, for this example, if there is a tie, first name wins, and thats fine.)
so im not sure where to start because i notice that some columns i wanted sort ascending (state/time/sex/name), and some descending (age)
many thanks in advance!
"Not New York, Kansas
maybe its just me, (well im pretty sure its just me) but i'm having a hard time trying to figure out the best way to sort a particular text file.
sample race data:
(name,sex,state,secs)
Sally,female,indiana,26,23443
Mike,male,ohio,23,23423
Jim,male,indiana,29,12355
etc...
so lets say the complete data had almost every state present and ages 20 - 29 with a mix of boys/girls. i want to sort by: state, age, sex, seconds, name. Sure in excel, this is easy, but additionally, i want to export only the top in each category to a file. (basically the winners to a file).
so the results like:
Alabama, 29, Female, [time], [name]
Alabama, 29, Male, [time], [name]
Alabama, 28, Female, [time],[name]
etc..
so there might be 80,000 racers, but i only need the top in each category. However, i want to throw in that maybe no females age 23 from Maine participated. so there would be no line in the output file for that. (so yeah, for this example, if there is a tie, first name wins, and thats fine.)
so im not sure where to start because i notice that some columns i wanted sort ascending (state/time/sex/name), and some descending (age)
many thanks in advance!
"Not New York, Kansas