Last active
September 26, 2016 02:25
-
-
Save dspp779/993e71217e66e3cf26d0096a0c85ec66 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
require 'yaml' | |
require 'csv' | |
if ARGV.size == 2 | |
data = YAML.load_file(ARGV[0]) | |
CSV.open(ARGV[1], 'wb', col_sep: '\t') do |csv| | |
csv << data.first.keys | |
data.to_a.each { |item| csv << item.values } | |
end | |
else | |
STDERR.puts 'usage: ruby yml_to_tsv.rb path/to/yml path/to/tsv' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment