On Feb 2, 10:52 am, Michael Sc <michael.schat... / gmail.com> wrote: > Hello, > I am a newbie with Ruby and I had a couple of questions while > manipulating csv files. How would I do a multiple column sort? I have > a file that needs to be sorted by the 3rd column, then 1st, then second. > I understand how to do one sort for the csv file but I was unsure of how > to do multiple. > > Also,How would I to do a percentage change between two numbers in a > column? > > Thank you very much. I know these are easy questions but I am still > learning how to program in Ruby. > > -- > Posted viahttp://www.ruby-forum.com/. [ [9,'ash','cube'], [8,'blue','cube'], [3,'mauve','frustrum'], [8,'green','cube'] ].sort_by{|a| a.values_at( 2,0,1 ) }. each{|a| p a } --- output ----- [8, "blue", "cube"] [8, "green", "cube"] [9, "ash", "cube"] [3, "mauve", "frustrum"]