From 9a50b5cadbbf7c0b68acf678af4f15d783006d24 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 16 Apr 2023 23:54:10 +0200 Subject: [PATCH] Fix bug adding missing columns --- bin/csv2human | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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++; } -- 2.47.3