daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Sep 23rd, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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