Skip to content

Instantly share code, notes, and snippets.

@nchapman
Created March 31, 2010 22:57
Show Gist options
  • Save nchapman/351047 to your computer and use it in GitHub Desktop.
Save nchapman/351047 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'fastercsv'
def normalize(row)
row[2].sub!(/^0+/, "")
row[3].sub!(/^0+/, "")
return row
end
old_rows = FasterCSV.read "old.csv"
new_rows = FasterCSV.read "new.csv"
old_rows.each { |row| normalize(row) }
new_rows.each { |row| normalize(row) }
additions = new_rows - old_rows
deletions = old_rows - new_rows
puts "Additions \n"
additions.each { |a| puts a.inspect }
puts
puts "Deletions \n"
deletions.each { |d| puts d.inspect }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment