From: nobu.nokada@... Date: 2001-12-28T14:40:24+09:00 Subject: [ruby-talk:29513] Re: How to sort " sort -k3,3 -k9,9 file" Hi, At Fri, 28 Dec 2001 14:14:41 +0900, desibtis@hotmail.com (Sang DeSibtis) wrote: > How do I sort an array of lines having fix number of columns without > having to pass in a block of code to the array.sort() methode ? I > would like the output to be like the subject line--sort column 3 and > column 9. Like, sort -k3,3 -k9,9 filename . In 1.6: array.collect {|s| [s[2], s[8], s]}.sort.collect {|s| s.last} In 1.7: array.sort_by {|s| [s[2], s[8]]} Nobu Nakada