From: brabuhr@... Date: 2010-07-03T05:19:00+09:00 Subject: Re: FasterCSV - Merge CSV On Fri, Jul 2, 2010 at 3:27 PM, Rob Biedenharn wrote: > OK, let's read them all in and then write out one file... > > headers = nil > all_rows = [] > input_files.each do |input_file| >  csv = FasterCSV.table(input_file, :headers => true) >  in_headers, *in_rows = csv.to_a >  headers ||= in_headers >  all_rows.concat(in_rows) > end > FasterCSV.open(output_file, 'w') do |csv| >  csv << headers >  all_rows.each {|row| csv << row } > end FasterCSV.open(output_file, 'w') do |ocsv| input_files.each_with_index do |input_file, i| FasterCSV.foreach(input_file, :headers => true, :return_headers => true) do |row| next if i > 0 and row.header_row? ocsv << row end end end