]> git.nbdom.net Git - nb.git/commitdiff
bin/csv2human master
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 18 Nov 2025 07:53:12 +0000 (08:53 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 18 Nov 2025 07:53:12 +0000 (08:53 +0100)
bin/csv2human

index 284242963f340bee0d72907c5bc4cb429ee85006..a7471db4ba905d2164feb3e61d4ed0671fab0594 100755 (executable)
@@ -41,9 +41,6 @@ $main::_DATA_ = undef;
 #################################################################################
 #use Data::Dumper; print Dumper(\%Opt);
 use Encode;
-binmode( STDOUT, "raw:" );
-# NB 13.12.23 binmode( STDOUT, "utf8:" );
-
 
 #
 # Calculate lengths
@@ -54,16 +51,11 @@ my @lines = ();
 use Encode;
 my $ENCODE = 1;
 binmode STDOUT, ":utf8" if $ENCODE;
+#binmode STDOUT, "raw:";
 #binmode STDOUT;
 sub realLength() {
-       #return scalar( map $_, $_[0] =~ /(.)/gs );
-       #my $l = length($_[0]);
-       #my $l = bytes::length($_[0]);
        $_[0] = Encode::decode_utf8($_[0]) if $ENCODE;
-       #return $l;
        return length($_[0]);
-               #$F[$i] = Encode::encode_utf8($F[$i]);
-       #return bytes::length($_[0]);
 }
 
 while (<>) {
@@ -98,10 +90,6 @@ if ($ENCODE) {
        $sep_line = Encode::decode("UTF-8",$sep_line);
        $sep_line_last = Encode::decode("UTF-8",$sep_line_last);
 }
-# NB 23.01.24 my $format = "| ".join(" | ",map {$t+=$_+3; "\%-".$_."s"} @len)." |".chr(10);
-# NB 23.01.24 my $sep_line = "+".join("+",map {("-"x($_+2))} @len)."+".chr(10);
-# NB 23.01.24 my $sep_line_first = $sep_line;
-# NB 23.01.24 my $sep_line_last = $sep_line;
 
 #
 # Format / align 
@@ -141,7 +129,6 @@ while (my $line = shift @lines)
        }
 
        printf $format,@$line;
-       # NB 23.01.24 printf $format,map{$ENCODE ? Encode::encode_utf8($_) : $_} @$line;
        print $sep_line if $Opt{header} and !$i++;
 }