Bug 150698 - Awk does not honor the FIELDWIDTHS variable
Summary: Awk does not honor the FIELDWIDTHS variable
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: gawk
Version: 3.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Miloslav Trmač
QA Contact: Brock Organ
URL: http://www.unc.edu/~jennyw/Awk_Bug/Aw...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-09 19:38 UTC by Jenny Williams
Modified: 2007-11-30 22:07 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-14 17:16:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jenny Williams 2005-03-09 19:38:13 UTC
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):
gawk-3.1.1-9

How reproducible:
Always

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}'
3.
  

Actual Results:  >1234567
>
>

Expected Results:  >1
>2345

Additional info:

Comment 1 Miloslav Trmač 2005-03-14 00:05:44 UTC
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}'
Thanks.

Comment 2 Jenny Williams 2005-03-14 17:16:38 UTC
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.