Skip to content

Instantly share code, notes, and snippets.

@jordanstephens
Created November 19, 2012 18:10
Show Gist options
  • Save jordanstephens/4112404 to your computer and use it in GitHub Desktop.
Save jordanstephens/4112404 to your computer and use it in GitHub Desktop.
convert aaia car list tsv to ymm yaml
require 'yaml'
ARGV.each do |arg|
cars = []
File.readlines(arg).each do |line|
row = line.split("\t")
year = row[1]
make = row[2].capitalize
model = row[3].capitalize
cars << {
year: year,
make: make,
model: model
}
end
File.open("#{arg}.yml", 'w') { |f| f.write(cars.uniq.to_yaml) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment