calculate average from numbers by stdin

This commit is contained in:
olli 2023-10-31 17:20:49 +01:00
parent 4cbdf35bb5
commit eeffd07384

3
gaboshlib/g_average.sh Normal file
View File

@ -0,0 +1,3 @@
function g_average {
cat | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }'
}