Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 150698 - Awk does not honor the FIELDWIDTHS variable
Awk does not honor the FIELDWIDTHS variable
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gawk (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Miloslav Trmač
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2005-03-09 14:38 EST by Jenny Williams
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-14 12:16:38 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jenny Williams 2005-03-09 14:38:13 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

Description of problem:
Awk from RHN for RHEL 3.0 does not honor the FIELDWIDTHS variable.  Instead of breaking down an item into its atomic pieces to be counted out as described under the FIELDWIDTHS topic for man awk, it continues to behave as if FS=" " were still in effect, which is a setting that is supposed to be overridden when the FIELDWIDTHS variable is used.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.echo 1234567 | awk -v FIELDWIDTHS="1 4 1" '{print $1}'
2.echo 1234567 | awk -v FIELDWIDTHS="1 4 1" '{print $2}'

Actual Results:  >1234567

Expected Results:  >1

Additional info:
Comment 1 Miloslav Trmač 2005-03-13 19:05:44 EST
This works fine for me; please append the output of the following commands:
        which awk
        rpm -V gawk
        echo 1234567 | awk -W lint -v FIELDWIDTHS="1 4 1" '{print $2}'
Comment 2 Jenny Williams 2005-03-14 12:16:38 EST
This ended up being an issue whith whether or not POSIX compliance was in effect.  
The POSIXLY_CORRECT variable was set on my environment to 1.
This version of gawk honors that variable to toggle POSIX compliance
in the manner described in man gawk .  The older version I was comparing it
against did not behave this way.
Thank you for your time on this issue.
The hint was as follows:
$ echo 1234567 | awk -W lint -v FIELDWIDTHS="1 4 1" '{print $2}'
$ awk: warning: `FIELDWIDTHS' is a gawk extension
$ awk: warning: environment variable `POSIXLY_CORRECT' set: turning on `--posix'

Note You need to log in before you can comment on or make changes to this bug.