]> granicus.if.org Git - pgbadger/commitdiff
Fix xz command to be script readable and always have size in bytes: xz --robot -l...
authorDarold Gilles <gilles@darold.net>
Mon, 31 Mar 2014 19:47:03 +0000 (21:47 +0200)
committerDarold Gilles <gilles@darold.net>
Mon, 31 Mar 2014 19:47:03 +0000 (21:47 +0200)
pgbadger

index e4a86f9bace3627de9c0f722f48aba865eb17814..800468eca73a409b10eb1d421bd6de8a99370ab1 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -98,7 +98,7 @@ my $ucat                    = 'unzip -p';
 my $xzcat                   = 'xzcat';
 my $gzip_uncompress_size    = "gunzip -l %f | grep -E '^\\s*[0-9]+' | awk '{print \$2}'";
 my $zip_uncompress_size     = "unzip -l %f | awk '{if (NR==4) print \$1}'";
-my $xz_uncompress_size      = "xz -l %f | grep %f | awk '{print \$5}'";
+my $xz_uncompress_size      = "xz --robot -l %f | grep totals | awk '{print \$5}'";
 my $format                  = '';
 my $outfile                 = '';
 my $outdir                  = '';
@@ -9900,8 +9900,7 @@ sub get_log_file
                        my $cmd_file_size = $gzip_uncompress_size;
                        if ($logf =~ /\.zip/i) {
                                $cmd_file_size = $zip_uncompress_size;
-                       }
-                       if ($logf =~ /\.xz/i) {
+                       } elsif ($logf =~ /\.xz/i) {
                                $cmd_file_size = $xz_uncompress_size;
                        }                       
                        $cmd_file_size =~ s/\%f/$logf/g;