From 89b7b67a13ebb7965cc7f13ad0595e2194a2d34c Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:48:04 +0200 Subject: add sqmail-4.2.29a --- src/ddist.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/ddist.sh (limited to 'src/ddist.sh') diff --git a/src/ddist.sh b/src/ddist.sh new file mode 100644 index 0000000..b632572 --- /dev/null +++ b/src/ddist.sh @@ -0,0 +1,31 @@ + +awk '/^d k/ { print $5 - $3 }' \ +| sort -n \ +| awk ' + { x += 1; cumulative[$1] = x } + END { + if (x > 0) { + for (p = 0;p <= 100;++p) mindel[p] = -1 + for (d in cumulative) { + p = int((cumulative[d] * 100) / x) + if (mindel[p] == -1) mindel[p] = d + else if (d < mindel[p]) mindel[p] = d + totdel[p] += d + numdel[p] += 1 + } + td = 0 + nd = 0 + for (p = 0;p <= 100;++p) { + td += totdel[p] + nd += numdel[p] + if (p >= 10) + if (nd > 0) + if (mindel[p] >= 0) { + str1 = sprintf("%.2f",mindel[p]) + str2 = sprintf("%.2f",td / nd) + print str1, str2, p + } + } + } + } +' -- cgit v1.2.3