indicate limited results in stats
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 7 Sep 2019 16:11:46 +0000 (18:11 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 8 Sep 2019 13:57:09 +0000 (15:57 +0200)
barcat

diff --git a/barcat b/barcat
index 2c1104871194a4ae25395113c6a215599ddcf112..c9b36cacfd853edf56dbae87ef11fc98735fb0e7 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -171,6 +171,11 @@ while ($nr <= $#lines) {
 show_lines();
 
 if ($opt{stat}) {
+       if ($opt{hidemin} or $opt{hidemax}) {
+               $opt{hidemin} ||= 1;
+               $opt{hidemax} ||= @lines;
+               printf '%s of ', sum(@values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0;
+       }
        my $total = sum @order;
        printf '%s total', $total;
        printf ' in %d values', scalar @values;