Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'yaml'
- structure = []
- key = ''
- File.open(ARGV[0], 'r').each_line.with_index do |lines, index|
- data = lines.chomp.split("\t")
- key << data if index.zero?
- structure << Hash[key.zip(data)] if index > 0
- File.open(ARGV[1], 'w') do |file|
- file.puts structure.to_yaml if ARGV[1]
- print structure.to_yaml
- end
- end
Add Comment
Please, Sign In to add comment