summaryrefslogtreecommitdiff
path: root/sum4.awk
diff options
context:
space:
mode:
authorwukong <wukong@longaeva>2018-06-18 04:00:29 -0700
committerwukong <wukong@longaeva>2018-06-18 04:00:29 -0700
commitc44ac59acbb18c6982e180637566dec8eb9baebd (patch)
tree66ea1e51ed0a60b2fdf48ea1b1c5b852007a05fd /sum4.awk
parent2482727a6902e44e6a68236f878f5f9bf7947bd2 (diff)
adjusted print statements to use OFMT, OFS, and ORS;
Diffstat (limited to '')
-rw-r--r--sum4.awk7
1 files changed, 3 insertions, 4 deletions
diff --git a/sum4.awk b/sum4.awk
index f9037da..2c3a41b 100644
--- a/sum4.awk
+++ b/sum4.awk
@@ -5,7 +5,7 @@
# output: sums of numeric columns
function isnum(n) {
- OFMT = "%.18g"
+ #OFMT = "%.18g"
sign = "[+-]?"
decimal = "[0-9]+[.]?[0-9]*"
fraction = "[.][0-9]+"
@@ -31,8 +31,7 @@ NR==1 {
END {
for (i=1; i<=nf_max; i++) {
if (header[i])
- printf("%s: \t", header[i])
- printf("%.18g\n", sum[i])
- printf(i < nf_max ? "" : OFS )
+ printf("%s:" OFS, header[i])
+ printf(OFMT ORS, sum[i])
}
}