in reply to Sorting within a file

puts ARGF.sort_by{|l|l.split(/\s+/)[0].to_i}