in reply to Invert CSV

If I understand correctly, what you need is a PIVOT. Here is a way to do so:

$ cat pivot.pl #!/pro/bin/perl use strict; use warnings; use Text::CSV_XS; use Spreadsheet::Read; my $ss = ReadData (shift)->[1]; my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1, eol => "\r +\n" }); $csv->print (*STDOUT, [@{$ss->{cell}[$_]}[1..$ss->{maxrow}]]) for 1 .. + $ss->{maxcol}; $ cat test.csv a,b,c,d,e,f 1,2,3,4,5,6 2,3,4,5,6,7 3,4,5,6,7,8 4,5,6,7,8,9 $ perl pivot.pl test.csv a,1,2,3,4 b,2,3,4,5 c,3,4,5,6 d,4,5,6,7 e,5,6,7,8 f,6,7,8,9 $

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^2: Invert CSV
by roadtest (Sexton) on May 31, 2011 at 16:39 UTC
    Thanks, I will consider to install these modules if similar requests keep coming:-)