From: William James Date: 2006-12-12T06:25:06+09:00 Subject: Re: Newbie with a project.(Parse tabed file and gen statistics?) Paul Lutus wrote: > Paul Lutus wrote: > > / ... > > > Experiment with this program: > > A hasty correction: > > ----------------------------- > > #!/usr/bin/ruby -w > > data = File.read("data.tsv") > > database = [] > > data.each do |line| > database << line.split(/\t/) > end > > database = database.sort { |a,b| b[4].to_i <=> a[4].to_i } > > puts database > > ----------------------------- > > -- > Paul Lutus > http://www.arachnoid.com p IO.readlines('junk').map{|s| s.chomp.split("\t")}.sort_by{|a| a[4].to_i}