From c53af60c891fa06b285e2cbba40b60fcb3419aaf Mon Sep 17 00:00:00 2001 From: Leon Rische Date: Wed, 29 Apr 2020 23:01:11 +0200 Subject: Generate S-expressions in stats awk scripts --- awk/stats_cards.awk | 14 ++++++++------ awk/stats_positions.awk | 22 ++++++++++++---------- 2 files changed, 20 insertions(+), 16 deletions(-) (limited to 'awk') diff --git a/awk/stats_cards.awk b/awk/stats_cards.awk index 44cd9b3..31a0047 100644 --- a/awk/stats_cards.awk +++ b/awk/stats_cards.awk @@ -37,12 +37,14 @@ BEGIN { } END { - print "total" "\t" total; - print "suspended" "\t" n_suspended; - print "created-day" "\t" created["day"]; - print "created-week" "\t" created["week"]; - print "created-month" "\t" created["month"]; + print "(" + print " :total " total; + print " :suspended " n_suspended; + print " :created-day " created["day"]; + print " :created-week " created["week"]; + print " :created-month " created["month"]; for (var in by_type) { - print "type-" var "\t" by_type[var]; + print " :type-" var " " by_type[var]; } + print ")" } diff --git a/awk/stats_positions.awk b/awk/stats_positions.awk index 735013a..c276f87 100644 --- a/awk/stats_positions.awk +++ b/awk/stats_positions.awk @@ -33,20 +33,22 @@ BEGIN { } END { - print "total" "\t" total; - print "suspended" "\t" suspended; - print "due" "\t" due; + print "(" + print " :total " total; + print " :suspended " suspended; + print " :due " due; for (var in by_type) { - print "type-" var "\t" by_type[var]; + print " :type-" var " " by_type[var]; } if (n_stats > 0) { - print "avg-ease" "\t" ease / n_stats; - print "avg-box" "\t" box / n_stats; - print "avg-interval" "\t" interval / n_stats; + print " :avg-ease " ease / n_stats; + print " :avg-box " box / n_stats; + print " :avg-interval " interval / n_stats; } else { - print "avg-ease" "\t" 0.0; - print "avg-box" "\t" 0; - print "avg-interval" "\t" 0.0; + print " :avg-ease " 0.0; + print " :avg-box " 0; + print " :avg-interval " 0.0; } + print ")" } -- cgit v1.2.3