generate csv output
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 8 Jul 2023 07:34:39 +0000 (09:34 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 8 Jul 2023 07:34:39 +0000 (09:34 +0200)
    3575 out.2023-07-08T09:21:02.csv
     296 out.2023-07-08T09:21:02.log
      54 out.2023-07-08T09:21:02.skip

p.pl

diff --git a/p.pl b/p.pl
index caed5e9..4eef17a 100755 (executable)
--- a/p.pl
+++ b/p.pl
@@ -71,7 +71,7 @@ sub glob_id {
 }
 
 open(my $skipped_input, '>',"out.$today.skip");
-open(my $out_fh, '>', "out.$today");
+open(my $out_fh, '>', "out.$today.csv");
 my @out_header;
 
 while(<$fh>) {
@@ -155,7 +155,7 @@ while(<$fh>) {
                                push @out_header, map { $h2[$_] }
                                        ( $h2nr->{'AU01_c'} .. $h2nr->{'AU45_c'} );
                                warn "# out_header ",dump( \@out_header );
-                               print $out_fh join("\t", @out_header),"\n";
+                               print $out_fh join(",", @out_header),"\n";
                        }
                        next;
                }
@@ -206,7 +206,7 @@ while(<$fh>) {
                        push @add_cols, map { $sum[$_] / $count } ( $h2nr->{'AU01_r'} .. $h2nr->{'AU45_r'} );
                        push @add_cols, map { $sum[$_] }          ( $h2nr->{'AU01_c'} .. $h2nr->{'AU45_c'} );
                        warn "# add_cols = ",dump( \@add_cols ) if $debug;
-                       print $out_fh join("\t", @v, @add_cols ), "\n";
+                       print $out_fh join(",", @v, @add_cols ), "\n";
 
                        @sum = ();
                        $count = 0;