suresh wrote:
> multiplied by the number of these
> strings  occurrences in a column 
>

The previous solution doesn't account for that requirement, and the 
solution won't work on a file with column headings.  Here is a way to 
tabulate your data, so that you can calculate your index:

require 'rubygems'
require 'fastercsv'

totals = {'Poor' =>[0,0,0], 'Fair'=>[0,0,0], 'Excellent'=>[0,0,0]}
cols = totals.length

FasterCSV.foreach('data.txt', :headers =>true) do |row|
  cols.times do |i|
    totals[row[i+1]][i] += 1
  end
end

p totals

--output:--
{"Excellent"=>[2, 2, 1], "Poor"=>[2, 1, 1], "Fair"=>[3, 4, 5]}

-- 
Posted via http://www.ruby-forum.com/.