daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Sep 23rd, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'yaml'
  2. structure = []
  3. key = ''
  4. File.open(ARGV[0], 'r').each_line.with_index do |lines, index|
  5.   data = lines.chomp.split("\t")
  6.   key << data if index.zero?
  7.   structure << Hash[key.zip(data)] if index > 0
  8.   File.open(ARGV[1], 'w') do |file|
  9.     file.puts structure.to_yaml if ARGV[1]
  10.     print structure.to_yaml
  11.   end
  12. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top