From: Darold Gilles Date: Mon, 31 Mar 2014 19:47:03 +0000 (+0200) Subject: Fix xz command to be script readable and always have size in bytes: xz --robot -l... X-Git-Tag: v5.1~32^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3089ae2facaa4786b90325735f8e849be4da614;p=pgbadger Fix xz command to be script readable and always have size in bytes: xz --robot -l %f | grep totals | awk "{print $5}" --- diff --git a/pgbadger b/pgbadger index e4a86f9..800468e 100755 --- 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;