Question : Ruby csv column sort

Hello
Want to know how to sort by column asc or desc
Script is .......
require 'csv'  
  people = CSV.read("c:/foo.txt")
  joe = people.find_all {|person| person[0] =~ /Joe/}
 
#when writing back to file I want to sort by column 2 ascending (file has 3 columns)
  CSV.open("c:/fooreturn.txt","w") do |csv|
    joe.each do |person|
      csv <    end
  end

Answer : Ruby csv column sort

graphs:
various techniques used
- the svg library
- creating XML, than generating SVG using XSLT

I have not used scruffy

filtering out the second column... you can use a collect statement
  joe = people.find_all {|person| person[0] =~ /Joe/}
  joe = joe.sort_by {|j| j[1]}.reverse!
  joe.collect!{|arr| [arr[0] , arr[2]]}
Random Solutions  
 
programming4us programming4us