Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000607 [1003.1(2008)/Issue 7] Shell and Utilities Comment Enhancement Request 2012-09-14 20:28 2024-06-11 08:52
Reporter weeks View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Nathan Weeks
Organization USDA-ARS
User Reference
Section awk
Page Number 0
Line Number 0
Interp Status ---
Final Accepted Text See Note: 0001369
Summary 0000607: awk nextfile statement
Description When processing multiple input files with awk, it is sometimes useful to process only an initial subset of records in some of the input files. Many awk implementations support a "nextfile" statement that causes awk to abandon processing of the current input file and begin processing the next input file.

Without the availability of the nextfile statement, an awk program that wishedto cease processing the current input file (but continue processing remaining input files) would have to read and ignore the remaining records in the current input file. This method can be very inefficient when processing large input files.

The nextfile statement is supported by the vast majority of current awk implementations, specifically:

* BWK awk 20070501
* gawk 3.1.7
* mawk 1.3.4
* BusyBox awk 1.15.1
* awka 0.7.5
* QSE awk 0.5.6

Support is notably absent from:
* Solaris 10 /usr/xpg4/bin/awk
* jawk 1.02

The fact that nextfile is not supported by the Solaris /usr/xpg4/bin/awk should not be of concern, since "xpg4" implies SUSv2 or earlier standards.

Note that mawk and BWK awk do not support the nextfile statement in user-defined functions.
Desired Action Add a paragraph to the "Actions" section similar to the following:

The nextfile statement shall cause all further processing of the current input
file to be abandoned. The behavior is undefined if a nextfile statement
appears or is invoked in a BEGIN or END action, or in a user-defined function.

Add nextfile to the grammar, i.e.:

%token Next Nextfile Print Printf Return While
/* 'next' 'nextfile' 'print' 'printf' 'return' 'while' */
...
terminatable_statement : simple_statement
                 | Break
                 | Continue
                 | Next
                 | Nextfile
                 | Exit expr_opt
                 | Return expr_opt
                 | Do newline_opt terminated_statement While '(' expr ')'
                 ;

Add "nextfile" to list of keywords recognized as individual tokens in the "Lexical Conventions" section, list item 10.
Tags issue8
Attached Files

- Relationships

-  Notes
(0001369)
nick (manager)
2012-09-19 16:21
edited on: 2012-09-19 16:28

Add a paragraph to the "Actions" section after p2441 line 77586:

The nextfile statement shall cause all further processing of the current input
file to be abandoned. The behavior is undefined if a nextfile statement
appears or is invoked in a BEGIN or END action, or in a user-defined function.

Add nextfile to the grammar p2447 line 77834 and 77835, i.e.:

%token Next Nextfile Print Printf Return While
/* 'next' 'nextfile' 'print' 'printf' 'return' 'while' */
...(at line 77923)...
terminatable_statement : simple_statement
                 | Break
                 | Continue
                 | Next
                 | Nextfile
                 | Exit expr_opt
                 | Return expr_opt
                 | Do newline_opt terminated_statement While '(' expr ')'
                 ;

Add "nextfile" to list of keywords (in alphabetical order) recognized as individual tokens in the "Lexical Conventions" section, list item 10 at line 78172.

Add to p2438 line 77449:
"Records skipped by the nextfile statement shall not be included."

Change p2440 line 77544:
   Each END pattern shall be matched once and its associated action exectued after the last record of input has been read.

To:

   Each END pattern shall be matched once and its associated action exectued after the last record of input has been read, or if there is no further input file to process following a nextfile statement.


- Issue History
Date Modified Username Field Change
2012-09-14 20:28 weeks New Issue
2012-09-14 20:28 weeks Status New => Under Review
2012-09-14 20:28 weeks Assigned To => ajosey
2012-09-14 20:28 weeks Name => Nathan Weeks
2012-09-14 20:28 weeks Organization => USDA-ARS
2012-09-14 20:28 weeks Section => awk
2012-09-14 20:28 weeks Page Number => 0
2012-09-14 20:28 weeks Line Number => 0
2012-09-19 16:21 nick Note Added: 0001369
2012-09-19 16:21 nick Interp Status => ---
2012-09-19 16:21 nick Final Accepted Text => See Note: 0001369
2012-09-19 16:21 nick Status Under Review => Resolved
2012-09-19 16:21 nick Resolution Open => Accepted As Marked
2012-09-19 16:22 nick Tag Attached: issue8
2012-09-19 16:22 nick Note Edited: 0001369
2012-09-19 16:26 nick Note Edited: 0001369
2012-09-19 16:27 nick Note Edited: 0001369
2012-09-19 16:28 nick Note Edited: 0001369
2020-03-20 09:49 geoffclare Status Resolved => Applied
2024-06-11 08:52 agadmin Status Applied => Closed


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker