mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-10-30 03:27:04 +00:00
ddb82cb2e0
Maybe someday I'll become adept at using cvs...
11 lines
263 B
Plaintext
11 lines
263 B
Plaintext
# percent
|
|
# input: a column of nonnegative numbers
|
|
# output: each number and its percentage of the total
|
|
|
|
{ x[NR] = $1; sum += $1 }
|
|
|
|
END { if (sum != 0)
|
|
for (i = 1; i <= NR; i++)
|
|
printf("%10.2f %5.1f\n", x[i], 100*x[i]/sum)
|
|
}
|