I am currently using Ruby for a CSV file and I am trying to print a column data given a condition.
Severity Level
Least 1
Average 2
Normal 3
High 4
Severe 5
require "csv"
CSV.foreach('csvread.csv', :headers=>true) do |row|
if (row[1] == 2)
puts row.inspect
end
end
How do I select the Level column and print out the severity?
CSV file structure:
Severity;Level
Least;1
Average;2
Normal;3
High;4
Severe;5