I have recently emerged gawk-3.1.5. This caused to break my scripts because of a bug in handling of FIELDWIDTHS (a feature of GNU awk to parse text files with fields of fixed width). Apparently there is a bug in the routine that parses FIELDWIDTHS. I am attaching a patch. This has been reported to the maintainer of GNU awk with no answer at the moment.
Created attachment 82853 [details, diff] Proposed fix
Here is a simple test case of the bug AWK script: #!/usr/bin/awk -f BEGIN { FIELDWIDTHS = "15 15 15 "; } { x = $1; y = $2; z = $3; print "x y z", x, y, z } Awk input file (ensure that each column is 15 characters wide): 0.4867373206 1.3206333033 -0.2333178127 0.5668176165 1.3711756314 -0.2193558040 0.4325251781 1.3399488722 -0.1568307497 Expected output x y z 0.4867373206 1.3206333033 -0.2333178127 x y z 0.5668176165 1.3711756314 -0.2193558040 x y z 0.4325251781 1.3399488722 -0.1568307497 Obtained output: x y z 0.4867373206 1.3206333033 x y z 0.5668176165 1.3711756314 x y z 0.4325251781 1.3399488722
In the previous script there is a bug. There should be no space after the last number. Instead of: FIELDWIDTHS = "15 15 15 "; it should be: FIELDWIDTHS = "15 15 15";
Created attachment 84420 [details, diff] gawk-3.1.5-fieldwidths.patch try this patch from Fedora instead
should be fixed with gawk-3.1.5-r1