#!/usr/bin/ruby # require 'csv' #first File are the domains domains = CSV.read(ARGV[0], {:col_sep => ";"}) #handles # handles = CSV.read(ARGV[1], {:col_sep => ";"}) thead_d = domains.shift thead_h = handles.shift thead = thead_d.values_at(0,2) + thead_h.values_at(5,6,7,14) puts "|_."+thead.join("|_.")+"|" everything = [] domains.each { |domain| handles.each { |handle| idx = handle.index(domain[3]) if(idx) e_row = domain.values_at(0,2) + handle.values_at(5,6,7,14) everything << e_row puts "|"+(e_row).join("|")+"|" end } }