On Fri, Jul 2, 2010 at 3:27 PM, Rob Biedenharn
<Rob / agileconsultingllc.com> wrote:
> OK, let's read them all in and then write out one file...
>
> headers =3D nil
> all_rows =3D []
> input_files.each do |input_file|
> =A0csv =3D FasterCSV.table(input_file, :headers =3D> true)
> =A0in_headers, *in_rows =3D csv.to_a
> =A0headers ||=3D in_headers
> =A0all_rows.concat(in_rows)
> end
> FasterCSV.open(output_file, 'w') do |csv|
> =A0csv << headers
> =A0all_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 =3D> true, :return_headers =3D>
true) do |row|
      next if i > 0 and row.header_row?
      ocsv << row
    end
  end
end