CSV file I have 1000 files in one directory. I want to call all teh csv files in that directory and execute if condition. if condition satisfies it should print name else nothing Example of csv name,id,address,country,food A,11,bcvhcbdc,india,biryani ...
require "csv"
path="/logs/*exception_evaluation_summary.csv"
#calling csv files in the directory
Dir.glob(path).each do |f|
#reading csv files
csv = CSV.read(f, :headers=>true, :encoding => "bom|utf-8")
csv.each do |record|
if (record['id'] != 0 && record['country']=="india" && record['food']=="biryani")
print record[name]
else
print "nothing"
end
Aucun commentaire:
Enregistrer un commentaire