WG15 Defect Report Ref: 9945-2-118
Topic: awk awk


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-118

 _____________________________________________________________________________

	Topic:                  awk
	Relevant Sections:       2.14.4

Defect Report:
-----------------------

        From: [email protected] (Judith Schmitz)
	Date: Apr 17, 1995
 
Dear Standards Board,
 	I would like to request an official interpretation from
WG15 concerning the following point in ISO/IEC 9945-2:1993 (POSIX.2).
 
Standard:		ISO/IEC 9945-2:1993
Topic:			awk 
 
We are requesting clarification of the following paragraph from page
167, lines 146-155:
"Execution of the awk program starts by first executing the actions
associated with all BEGIN patterns in the order they occur in the program.
Then each file operand (or standard input if no files were specified)
will be processed in turn by reading data from the file until a
record separator is seen (a newline character by default), splitting
the current record into fields using the current value of FS according
to the rules in Regular Expressions in section 4.1.7.4,, evaluating each
pattern in the program in order of occurrence, and executing the action
associated with each patter that matches the current record."

In particular, we are wondering how to interpret "the current value of FS".

This has implications for the following awk command:
awk '{FS="."} {print $1}' awkfile

where awkfile contains:
a.b.c d.e.f

Historical implementations print:
a

Does the standard require the following output?
a.b.c

Thank you.


Interpretation response
------------------------

This request is substantially identical to interpretation #80,
but it points out a case where the user can see the difference between 
lazy splitting and when it takes effect.  As with interpretation #80,
the standard clearly states the effects expected from awk, and conforming
implementations must conform to this, even if it does not match some historic
practices.  However, concerns have been raised about this which are being
forwarded to the sponsor. 



Rationale
-------------
None.
Forwarded to Interpretations group: May 04 1995
Proposed resolution forwarded: Aug 11 1995
Finalized: Sept 12 1995