From: Nicolas Boisselier Date: Sun, 16 Apr 2023 21:54:10 +0000 (+0200) Subject: Fix bug adding missing columns X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=9a50b5cadbbf7c0b68acf678af4f15d783006d24;p=nb.git Fix bug adding missing columns --- diff --git a/bin/csv2human b/bin/csv2human index b708251e..eda3028c 100755 --- a/bin/csv2human +++ b/bin/csv2human @@ -73,16 +73,27 @@ print $sep_line; my $i = 0; my $count; -while ($_ = shift @lines) { - if ($i == 0) { - $count = @$_; - } else { - for (my $j=@$_; $j<$count; $j++ ) { - $_->[$j] = ''; - } +while (my $line = shift @lines) +{ + # NB 16.04.23: I guess it was supposed ad missing columns + # NB 16.04.23 if ($i == 0) + # NB 16.04.23 { + # NB 16.04.23 $count = @$line; + # NB 16.04.23 } + # NB 16.04.23 else + # NB 16.04.23 { + # NB 16.04.23 for (my $j=@$line; $j<$count; $j++ ) + # NB 16.04.23 { + # NB 16.04.23 $line->[$j] = ''; + # NB 16.04.23 } + # NB 16.04.23 } + # Add missing empty columns + for (my $j=@$line; $j<@len; $j++ ) + { + $line->[$j] = ''; } - printf $format,@$_; + printf $format,@$line; print $sep_line if $Opt{header} and !$i++; }