Snoopy Dog schrieb: > Sam Gentle wrote: >> >> require 'enumerator' >> >> data = File.readlines(path) >> additional_data = File.readlines(second) >> data.concat(additional_data) >> >> data.sort! >> mergeddata = [data[0]] >> data.each_cons(2) {|x1,x2| mergeddata.push(x2) unless x1.split(/,/)[1] >> == x2.split(/,/)[1]} > > Sam, that works great. Snoopy, you mentioned in one of our posts that the suppliers might deliver inconsistent data, for example different volumes for the same date, and Sam's solution guarantees that you get only one row for each date. You should be aware, though, that it randomly chooses this one row. For some data, it could be the row of the first file, for other data it could be the row of the second file. If you want to prefer one of the suppliers over the others, you have to implement a slightly different algorithm. The problem is that Ruby's sort isn't a stable sort. Regards, Pit