From: brabuhr@... Date: 2011-01-26T11:33:38+09:00 Subject: Re: Obtain data from .csv On Tue, Jan 25, 2011 at 8:50 PM, Kamarulnizam Rahim wrote: > Yeah, iam still having trouble extracting some data from the csv file > (i.e All of the 'actions'). The thing is i need to extract those data > and transfer those data into an existing yaml file for some reason. DO > you know how to extract for example : > > Maximise use of natural lighting > Turn-off unnecessary lights/equipment > Install energy efficient lighting > Turn-off unnecessary air conditioning > > Thank you You mean something like this? $ ruby -v bar.rb ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] Maximise use of natural lighting Turn-off unnecessary lights/equipment Install energy efficient lighting Turn-off unnecessary air conditioning Repair or replace damaged oven/refrigerator seals Install draught proofing Consider energy efficiency labels when buying electrical items Insulate hot water pipes Insulate/optimise hot water cylinder(s) Get right size of hot water cylinder ... $ cat bar.rb require 'csv' CSV.open('ActionPlan.csv','r').each do |row| puts row[1] if row[0].to_s.match(/\d\.[a-z]/) end