The following issue has been SUBMITTED.
======================================================================
https://www.austingroupbugs.net/view.php?id=1823
======================================================================
Reported By: mortoneccc
Assigned To:
======================================================================
Project: 1003.1(2016/18)/Issue7+TC2
Issue ID: 1823
Category: Shell and Utilities
Type: Enhancement Request
Severity: Comment
Priority: normal
Status: New
Name: Ed Morton
Organization:
User Reference:
Section: awk
Page Number: 0
Line Number: 0
Interp Status: ---
Final Accepted Text:
======================================================================
Date Submitted: 2024-03-14 12:26 UTC
Last Modified: 2024-03-14 12:26 UTC
======================================================================
Summary: The impact of changing NR and/or FNR should be
defined
Description:
In most, if not all, modern awks a user can change the value of NR and/or
FNR and when the next record is read NR/FNR is incremented from the value
the user set it to rather than from the value it previously had:
$ seq 3 | awk 'NR==2{NR=7; FNR=23} {print NR, FNR, $0}'
1 1 1
7 23 2
8 24 3
but that behavior is currently not defined by POSIX.
Desired Action:
Add statements to the spec like:
---
Assigning NR a whole number shall set NR to that value from that point on
for processing of the current record and NR shall be incremented starting
with that value for all subsequent records read. Assigning NR any other
value is undefined behavior.
-
Assigning FNR a whole number shall set FNR to that value from that point on
for processing of the current record and NR shall be incremented starting
with that value for all subsequent records read. Assigning NR any other
value is undefined behavior.
---
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2024-03-14 12:26 mortoneccc New Issue
2024-03-14 12:26 mortoneccc Name => Ed Morton
2024-03-14 12:26 mortoneccc Section => awk
2024-03-14 12:26 mortoneccc Page Number => 0
2024-03-14 12:26 mortoneccc Line Number => 0
======================================================================