1[% USE CSV -%] 2[% CSV.dump([ 'Device' 'Port' 'Remote ID' 'Remote IP' 'Remote Port' 'Remote Type']) %] 3 4[% FOREACH row IN results %] 5 [% mylist = [] %] 6 [% device = row.dns || row.name || row.ip %] 7 [% FOREACH col IN [ device row.port row.remote_id row.remote_ip row.remote_port row.remote_type ] %] 8 [% mylist.push(col) %] 9 [% END %] 10 [% CSV.dump(mylist) %] 11 12[% END %] 13