Skip to content

Instantly share code, notes, and snippets.

@rkmathi
Created January 21, 2014 16:07
Show Gist options
  • Select an option

  • Save rkmathi/8542928 to your computer and use it in GitHub Desktop.

Select an option

Save rkmathi/8542928 to your computer and use it in GitHub Desktop.
csv to double-colon
require 'csv'
in_file = ARGV[0]
out_file = ARGV[1]
ramen_csv = CSV.table(in_file)
File.open(out_file, 'w') { |file|
ramen_csv.each_with_index { |row,i|
row.each { |r|
unless r[0] == :id or r[1].nil?
file.puts "#{i+1}::#{r[0]}::#{r[1]}"
end
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment