From: Dobrica Pavlinusic Date: Sat, 14 Sep 2013 12:55:15 +0000 (+0200) Subject: support tables with different number of columns (NUMTAG) X-Git-Url: http://git.rot13.org/?p=crolist2marc;a=commitdiff_plain;h=cf7450d318cea8ee3de26c3c3feac17ec03b165d support tables with different number of columns (NUMTAG) --- diff --git a/csv2tsv.pl b/csv2tsv.pl index fdbd848..6ace7eb 100755 --- a/csv2tsv.pl +++ b/csv2tsv.pl @@ -23,7 +23,7 @@ while(my $line = <>) { if ( $#v > $cols ) { #warn "FIX $#v $cols", dump(@v); my @l2 = splice( @v, -2 ); # keep last two - my @fix = splice( @v, 6 ); + my @fix = splice( @v, $cols - 3 ); warn "XXX before ",dump( @fix ); my ( $k, $v ) = ( shift(@fix), '' ); while ( @fix && (( length($k) + length($fix[0]) ) < 8 ) ) {