number of lines distinct from values in statistics
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 6 Oct 2019 23:48:38 +0000 (01:48 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 8 Oct 2019 00:34:26 +0000 (02:34 +0200)
Indicate ignored (non-numeric) rows if any.  Unchanged otherwise.

barcat
t/t1312-currency-crop_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-s.out
t/t1602-float_statistics_-sL0.out
t/t1603-added_statistics.in [new symlink]
t/t1603-added_statistics_-sL2-.out [new file with mode: 0644]
t/t1901-technicolor_-cs_--header.out
t/t1912-currency_part_-f,_--value-length=7_--minval=1.1_--maxval=1.11_-L10-30_-cs.out

diff --git a/barcat b/barcat
index fc4cb3c73afd869f6c1cb7080c8c6c54db3cc835..5676228584a0b2c42ba644ebc3afd5b3ce97b311 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -273,12 +273,13 @@ sub show_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;
+               printf '%s of ', sum(grep {length} @values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0;
        }
        if (@order) {
                my $total = sum @order;
                printf '%s total', color(1) . $total . color(0);
-               printf ' in %d values', scalar @values;
+               printf ' in %d values', scalar @order;
+               printf ' over %d lines', scalar @lines if @order != @lines;
                printf(' (%s min, %s avg, %s max)',
                        color(31) . $order[-1] . color(0),
                        color(36) . (sprintf '%*.*f', 0, 2, $total / @order) . color(0),
index 7cca89ba4f9921a81bdfdca9c7f53a636ae20385..e89c5ccf30a618fcfc3880bfdef2e97028c52dec 100644 (file)
@@ -19,4 +19,4 @@
 2019-08-22 1.1083 ------------------
 2019-08-21 1.1104 -----------------------
 2019-08-20 1.1076 -----------------
-23.1939 of 6386.71270000003 total in 5373 values (0.8252 min, 1.20 avg, 1.5990 max)
+23.1939 of 6386.71270000003 total in 5306 values over 5373 lines (0.8252 min, 1.20 avg, 1.5990 max)
index f6d0731e7ec1eb8d77179fce8796f9a9b4de1cbd..e067ae39f4fc914ef6696389dba4fe14c21ccdac 100644 (file)
@@ -1 +1 @@
--7.4589999998 total in 18 values (-3 min, -0.47 avg, 2 max)
+-7.4589999998 total in 16 values over 18 lines (-3 min, -0.47 avg, 2 max)
diff --git a/t/t1603-added_statistics.in b/t/t1603-added_statistics.in
new file mode 120000 (symlink)
index 0000000..7d1fc98
--- /dev/null
@@ -0,0 +1 @@
+t1008-unicode.in
\ No newline at end of file
diff --git a/t/t1603-added_statistics_-sL2-.out b/t/t1603-added_statistics_-sL2-.out
new file mode 100644 (file)
index 0000000..b0c7b03
--- /dev/null
@@ -0,0 +1,31 @@
+ 920 B -<-
+ 476 C -<
+ 619 Ĉ -<
+2094 D -<----+
+6552 E -<----+-=--->----------
+1062 F -<--
+ 766 G -<-
+ 738 Ĝ -<-
+ 371 H -
+   7 Ĥ 
+5513 I -<----+-=--->-------
+1140 J -<--
+  38 Ĵ 
+2558 K -<----+-=
+4253 L -<----+-=--->--
+2183 M -<----+-
+6321 N -<----+-=--->---------
+8110 O -<----+-=--->----------------
+2266 P -<----+-
+4387 R -<----+-=--->---
+5462 S -<----+-=--->------
+ 331 Ŝ -
+3534 T -<----+-=--->
+2579 U -<----+-=
+ 320 Ŭ -
+1458 V -<---
+ 383 Z -
+# 23731 whitespace
+4217 … -<----+-=--->--
+\r
+68658 of 77982 total in 29 values over 31 lines (7 min, 2689.03 avg, 9324 max)
index a08916e1fb50b9e8a36394420869bde39d9c6feb..415ea1604ff775be79825b661d89b6187ffd269d 100644 (file)
@@ -17,4 +17,4 @@
 \e[90m          1\e[0m-2     -------\e[36m<\e[0m--\e[36m=\e[0m-\e[36m|\e[0m-----
 \e[90m       -2.0\e[0m       ----
 --1    -------\e[36m<\e[0m--\e[36m=\e[0m-\e[36m|\e[0m
-\e[1m-7.4589999998\e[0m total in 18 values (\e[31m-3\e[0m min, \e[36m-0.47\e[0m avg, \e[32m2\e[0m max)
+\e[1m-7.4589999998\e[0m total in 16 values over 18 lines (\e[31m-3\e[0m min, \e[36m-0.47\e[0m avg, \e[32m2\e[0m max)
index eec7fb85e146250e48e6db8e60dd31e0968c6f8a..4ae6263ed653f13cf4fa670eb76be14257216409 100644 (file)
@@ -19,4 +19,4 @@
 2019-08-22\e[90m 1.1083\e[0m ------------------
 2019-08-21\e[32m 1.1104\e[0m -----------------------
 2019-08-20\e[90m 1.1076\e[0m -----------------
-23.1939 of \e[1m6386.71270000003\e[0m total in 5373 values (\e[31m0.8252\e[0m min, \e[36m1.20\e[0m avg, \e[32m1.5990\e[0m max)
+23.1939 of \e[1m6386.71270000003\e[0m total in 5306 values over 5373 lines (\e[31m0.8252\e[0m min, \e[36m1.20\e[0m avg, \e[32m1.5990\e[0m max)