From: James Gray Date: 2008-09-02T00:49:43+09:00 Subject: Re: Parsing a CSV file column-wise On Sep 1, 2008, at 6:09 AM, Chris Lowis wrote: > Is there a short-cut to parsing a CSV file column-wise using any of > the available Ruby CSV libraries ? Yes: #!/usr/bin/env ruby -wKU require "rubygems" require "faster_csv" data = "1,2,3\n4,5,6\n7,8,9" table = FCSV.parse( data, :headers => true, :return_headers => true ) table.by_col! table[0] # => ["1", "4", "7"] table[1] # => ["2", "5", "8"] table[2] # => ["3", "6", "9"] __END__ Hope that helps. James Edward Gray II