isaacmtz90
9/21/2016 - 8:00 AM

yml_to_tsv.rb

#Converts YAML to TSV files
require 'yaml'
require 'csv'

data = YAML.load(File.read(ARGV[0]))
CSV.open(ARGV[1], 'w', headers: data.first.keys, col_sep: "\t") do |tsv|
  tsv << data.first.keys
  data.each { |element| tsv << element.values }
end