Created
January 6, 2010 17:30
-
-
Save damon/270440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
begin | |
require 'rubygems' | |
require 'fastercsv' | |
fn,result = ARGV[0],{} | |
FasterCSV.foreach(fn) do |row| | |
d,p = row[0],row[1] | |
result[d] = 0 if !result[d] | |
result[d] += 1 if p.strip.upcase=="TRUE" | |
end | |
result.each_pair do |d,c| | |
puts "#{d},#{c}" | |
end | |
rescue Exception => e | |
puts "Hey - you really need to do sudo gem intall fastercsv first...Oh yeah, and pass in a filename too..." | |
puts e | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment