Created
January 21, 2014 16:07
-
-
Save rkmathi/8542928 to your computer and use it in GitHub Desktop.
csv to double-colon
This file contains hidden or 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
| 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