From 4c4eb1bd8f003b3b57707badd2dd089ed193a896 Mon Sep 17 00:00:00 2001 From: wukong Date: Fri, 10 Apr 2026 23:46:12 -0700 Subject: renamed fir window generators; minor edits to whitespace and comments for more consistent style; --- sum4.awk | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sum4.awk') diff --git a/sum4.awk b/sum4.awk index aa3f044..3e61843 100644 --- a/sum4.awk +++ b/sum4.awk @@ -15,17 +15,19 @@ function isnum(n) { } -BEGIN { OFS = FS } +BEGIN { + OFS = FS +} + NR == 1 { - nf_max = NF for (i=1; i<=NF; i++) isnum($i) ? header[i] = "col" i : header[i] = $i } -{ - if (NF > nf_max) - nf_max = NF + +NF > 0 { + (NF > nf_max) ? nf_max = NF : nf_max = nf_max for (i=1; i<=NF; i++) { if ($i == header[i]) continue @@ -36,6 +38,7 @@ NR == 1 { } } + END { for (i=1; i<=nf_max; i++) { printf((header[i]) ? header[i] OFS : OFS) -- cgit v1.2.3