diff options
Diffstat (limited to 'diff.awk')
| -rw-r--r-- | diff.awk | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -3,9 +3,9 @@ ### diff.awk # print numerical diff along columns + BEGIN { OFS = FS - # OFMT = "%.9g" sign = "[+-]?" decimal = "[0-9]+[.]?[0-9]*" fraction = "[.][0-9]*" @@ -13,6 +13,8 @@ BEGIN { number = "^" sign "(" decimal "|" fraction ")" exponent "$" } + +# column headers NR == 1 { # orig data columns for (n=1; n<=NF; n++) { @@ -35,9 +37,9 @@ NR == 1 { } } -NF { - if (NF > nf_max) - nf_max = NF + +NF > 0 { + (NF > nf_max) ? nf_max = NF : nf_max = nf_max # data columns for (n=1; n<=nf_max; n++) { |
