* lionbarrage <cmakalinaw / gmail.com> (02:17) schrieb: > File 1 > ALPHA|OMEGA|GAMMA > 1 | 2 | 3 > 4 | 5 | 6 > > File 2 > EPSILON|GREEK|OMEGA|BETA > 7 | 8 | 9 | 0 > 12 | | 13 | > 10 | 11 | 5 | 15 > > End result should be: > > ALPHA|OMEGA|GAMMA|EPSILON|GREEK|BETA > 1 | 2 | 3 | | | > 4 | 5 | 6 | 10 | 11 | 15 > | 9 | | 7 | 8 | 0 > | 13 | | 12 | | I hoped I fixed your ASCII art the right way. In understand that this represents named sets of integers that are to be merged. Right? The natural representation of that would be a hash containing sets. There is a set class, but I use arrays here: require 'pp' sets = Hash.new { | h, k | h[k] = [] } # hash that contains a new array # for every new key %w(file1.txt file2).each do | filename | File.open(filename) do | f | names = f.gets.chop.split('|') f.each do | line | names.zip(line.chop.split('|')).each do | name, value | sets[name] << value end end end end pp sets This code does no tabular printing, treats the "integers" as strings, without excluding empty strings and doubles. But that could easily be fixed. Probably I got it all wrong. :-( mfg, simon .... l