aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.info
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawk.info')
-rw-r--r--doc/gawk.info551
1 files changed, 279 insertions, 272 deletions
diff --git a/doc/gawk.info b/doc/gawk.info
index 275188ef..30ff2c26 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -8948,37 +8948,35 @@ starts processing it with the first rule in the program.

File: gawk.info, Node: Nextfile Statement, Next: Exit Statement, Prev: Next Statement, Up: Statements
-7.4.9 Using `gawk''s `nextfile' Statement
------------------------------------------
+7.4.9 The `nextfile' Statement
+------------------------------
-`gawk' provides the `nextfile' statement, which is similar to the
-`next' statement. (c.e.) However, instead of abandoning processing of
-the current record, the `nextfile' statement instructs `gawk' to stop
-processing the current data file.
-
- The `nextfile' statement is a `gawk' extension. In most other `awk'
-implementations, or if `gawk' is in compatibility mode (*note
-Options::), `nextfile' is not special.
-
- Upon execution of the `nextfile' statement, any `ENDFILE' rules are
-executed except in the case as mentioned below, `FILENAME' is updated
-to the name of the next data file listed on the command line, `FNR' is
-reset to one, `ARGIND' is incremented, any `BEGINFILE' rules are
-executed, and processing starts over with the first rule in the program.
-(`ARGIND' hasn't been introduced yet. *Note Built-in Variables::.) If
-the `nextfile' statement causes the end of the input to be reached,
-then the code in any `END' rules is executed. An exception to this is
-when the `nextfile' is invoked during execution of any statement in an
-`END' rule; In this case, it causes the program to stop immediately.
+The `nextfile' statement is similar to the `next' statement. However,
+instead of abandoning processing of the current record, the `nextfile'
+statement instructs `awk' to stop processing the current data file.
+
+ Upon execution of the `nextfile' statement, `FILENAME' is updated to
+the name of the next data file listed on the command line, `FNR' is
+reset to one, and processing starts over with the first rule in the
+program. If the `nextfile' statement causes the end of the input to be
+reached, then the code in any `END' rules is executed. An exception to
+this is when `nextfile' is invoked during execution of any statement in
+an `END' rule; In this case, it causes the program to stop immediately.
*Note BEGIN/END::.
The `nextfile' statement is useful when there are many data files to
process but it isn't necessary to process every record in every file.
-Normally, in order to move on to the next data file, a program has to
-continue scanning the unwanted records. The `nextfile' statement
-accomplishes this much more efficiently.
+Without `nextfile', in order to move on to the next data file, a program
+would have to continue scanning the unwanted records. The `nextfile'
+statement accomplishes this much more efficiently.
+
+ In `gawk', execution of `nextfile' causes additional things to
+happen: any `ENDFILE' rules are executed except in the case as
+mentioned below, `ARGIND' is incremented, and any `BEGINFILE' rules are
+executed (`ARGIND' hasn't been introduced yet. *Note Built-in
+Variables::.)
- In addition, `nextfile' is useful inside a `BEGINFILE' rule to skip
+ With `gawk', `nextfile' is useful inside a `BEGINFILE' rule to skip
over a file that would otherwise cause `gawk' to exit with a fatal
error. In this case, `ENDFILE' rules are not executed. *Note
BEGINFILE/ENDFILE::.
@@ -8989,6 +8987,11 @@ files, pipes, and coprocesses that are opened with redirections. It is
not related to the main processing that `awk' does with the files
listed in `ARGV'.
+ NOTE: For many years, `nextfile' was a `gawk' extension. As of
+ September, 2012, it was accepted for inclusion into the POSIX
+ standard. See the Austin Group website
+ (http://austingroupbugs.net/view.php?id=607).
+
The current version of the Brian Kernighan's `awk' (*note Other
Versions::) also supports `nextfile'. However, it doesn't allow the
`nextfile' statement inside function bodies (*note User-defined::).
@@ -10105,18 +10108,22 @@ However, if `--lint' is provided on the command line (*note Options::),
array is deleted.
All the elements of an array may be deleted with a single statement
-(c.e.) by leaving off the subscript in the `delete' statement, as
-follows:
+by leaving off the subscript in the `delete' statement, as follows:
delete ARRAY
- This ability is a `gawk' extension; it is not available in
-compatibility mode (*note Options::).
-
Using this version of the `delete' statement is about three times
more efficient than the equivalent loop that deletes each element one
at a time.
+ NOTE: For many years, using `delete' without a subscript was a
+ `gawk' extension. As of September, 2012, it was accepted for
+ inclusion into the POSIX standard. See the Austin Group website
+ (http://austingroupbugs.net/view.php?id=544). This form of the
+ `delete' statement is also supported by Brian Kernighan's `awk'
+ and `mawk', as well as by a number of other implementations (*note
+ Other Versions::).
+
The following statement provides a portable but nonobvious way to
clear out an array:(1)
@@ -25263,7 +25270,7 @@ Index
* Brennan, Michael <1>: Other Versions. (line 6)
* Brennan, Michael <2>: Simple Sed. (line 25)
* Brennan, Michael <3>: Two-way I/O. (line 6)
-* Brennan, Michael: Delete. (line 52)
+* Brennan, Michael: Delete. (line 56)
* Brian Kernighan's awk, extensions <1>: Other Versions. (line 13)
* Brian Kernighan's awk, extensions: BTL. (line 6)
* Broder, Alan J.: Contributors. (line 88)
@@ -26040,7 +26047,7 @@ Index
* functions, user-defined, counts: Profiling. (line 132)
* functions, user-defined, library of: Library Functions. (line 6)
* functions, user-defined, next/nextfile statements and <1>: Nextfile Statement.
- (line 44)
+ (line 47)
* functions, user-defined, next/nextfile statements and: Next Statement.
(line 45)
* G-d: Acknowledgments. (line 81)
@@ -26554,7 +26561,7 @@ Index
* nextfile statement, BEGINFILE/ENDFILE patterns and: BEGINFILE/ENDFILE.
(line 26)
* nextfile statement, user-defined functions and: Nextfile Statement.
- (line 44)
+ (line 47)
* nexti debugger command: Dgawk Execution Control.
(line 49)
* NF variable <1>: Auto-set. (line 107)
@@ -26743,7 +26750,7 @@ Index
* portability, close() function and: Close Files And Pipes.
(line 81)
* portability, data files as single record: Records. (line 180)
-* portability, deleting array elements: Delete. (line 52)
+* portability, deleting array elements: Delete. (line 56)
* portability, example programs: Library Functions. (line 31)
* portability, fflush() function and: I/O Functions. (line 29)
* portability, functions, defining: Definition Syntax. (line 99)
@@ -27149,7 +27156,7 @@ Index
* Spencer, Henry: Glossary. (line 12)
* split utility: Split Program. (line 6)
* split() function: String Functions. (line 315)
-* split() function, array elements, deleting: Delete. (line 57)
+* split() function, array elements, deleting: Delete. (line 61)
* split.awk program: Split Program. (line 30)
* sprintf() function <1>: String Functions. (line 380)
* sprintf() function: OFMT. (line 15)
@@ -27654,242 +27661,242 @@ Node: Break Statement372503
Node: Continue Statement374493
Node: Next Statement376286
Node: Nextfile Statement378676
-Node: Exit Statement381221
-Node: Built-in Variables383637
-Node: User-modified384732
-Ref: User-modified-Footnote-1392758
-Node: Auto-set392820
-Ref: Auto-set-Footnote-1402111
-Node: ARGC and ARGV402316
-Node: Arrays406167
-Node: Array Basics407672
-Node: Array Intro408498
-Node: Reference to Elements412816
-Node: Assigning Elements415086
-Node: Array Example415577
-Node: Scanning an Array417309
-Node: Controlling Scanning419623
-Ref: Controlling Scanning-Footnote-1424556
-Node: Delete424872
-Ref: Delete-Footnote-1427307
-Node: Numeric Array Subscripts427364
-Node: Uninitialized Subscripts429547
-Node: Multi-dimensional431175
-Node: Multi-scanning434269
-Node: Arrays of Arrays435860
-Node: Functions440505
-Node: Built-in441327
-Node: Calling Built-in442405
-Node: Numeric Functions444393
-Ref: Numeric Functions-Footnote-1448225
-Ref: Numeric Functions-Footnote-2448582
-Ref: Numeric Functions-Footnote-3448630
-Node: String Functions448899
-Ref: String Functions-Footnote-1472396
-Ref: String Functions-Footnote-2472525
-Ref: String Functions-Footnote-3472773
-Node: Gory Details472860
-Ref: table-sub-escapes474539
-Ref: table-sub-posix-92475893
-Ref: table-sub-proposed477236
-Ref: table-posix-sub478586
-Ref: table-gensub-escapes480132
-Ref: Gory Details-Footnote-1481339
-Ref: Gory Details-Footnote-2481390
-Node: I/O Functions481541
-Ref: I/O Functions-Footnote-1488196
-Node: Time Functions488343
-Ref: Time Functions-Footnote-1499235
-Ref: Time Functions-Footnote-2499303
-Ref: Time Functions-Footnote-3499461
-Ref: Time Functions-Footnote-4499572
-Ref: Time Functions-Footnote-5499684
-Ref: Time Functions-Footnote-6499911
-Node: Bitwise Functions500177
-Ref: table-bitwise-ops500735
-Ref: Bitwise Functions-Footnote-1504895
-Node: Type Functions505079
-Node: I18N Functions505549
-Node: User-defined507176
-Node: Definition Syntax507980
-Ref: Definition Syntax-Footnote-1512890
-Node: Function Example512959
-Node: Function Caveats515553
-Node: Calling A Function515974
-Node: Variable Scope517089
-Node: Pass By Value/Reference519064
-Node: Return Statement522504
-Node: Dynamic Typing525485
-Node: Indirect Calls526220
-Node: Internationalization535905
-Node: I18N and L10N537331
-Node: Explaining gettext538017
-Ref: Explaining gettext-Footnote-1543083
-Ref: Explaining gettext-Footnote-2543267
-Node: Programmer i18n543432
-Node: Translator i18n547632
-Node: String Extraction548425
-Ref: String Extraction-Footnote-1549386
-Node: Printf Ordering549472
-Ref: Printf Ordering-Footnote-1552256
-Node: I18N Portability552320
-Ref: I18N Portability-Footnote-1554769
-Node: I18N Example554832
-Ref: I18N Example-Footnote-1557467
-Node: Gawk I18N557539
-Node: Advanced Features558156
-Node: Nondecimal Data559669
-Node: Array Sorting561252
-Node: Controlling Array Traversal561949
-Node: Array Sorting Functions570186
-Ref: Array Sorting Functions-Footnote-1573860
-Ref: Array Sorting Functions-Footnote-2573953
-Node: Two-way I/O574147
-Ref: Two-way I/O-Footnote-1579579
-Node: TCP/IP Networking579649
-Node: Profiling582493
-Node: Library Functions589967
-Ref: Library Functions-Footnote-1592974
-Node: Library Names593145
-Ref: Library Names-Footnote-1596616
-Ref: Library Names-Footnote-2596836
-Node: General Functions596922
-Node: Strtonum Function597875
-Node: Assert Function600805
-Node: Round Function604131
-Node: Cliff Random Function605674
-Node: Ordinal Functions606690
-Ref: Ordinal Functions-Footnote-1609760
-Ref: Ordinal Functions-Footnote-2610012
-Node: Join Function610221
-Ref: Join Function-Footnote-1611992
-Node: Gettimeofday Function612192
-Node: Data File Management615907
-Node: Filetrans Function616539
-Node: Rewind Function620678
-Node: File Checking622065
-Node: Empty Files623159
-Node: Ignoring Assigns625389
-Node: Getopt Function626942
-Ref: Getopt Function-Footnote-1638246
-Node: Passwd Functions638449
-Ref: Passwd Functions-Footnote-1647424
-Node: Group Functions647512
-Node: Walking Arrays655596
-Node: Sample Programs657165
-Node: Running Examples657830
-Node: Clones658558
-Node: Cut Program659782
-Node: Egrep Program669627
-Ref: Egrep Program-Footnote-1677400
-Node: Id Program677510
-Node: Split Program681126
-Ref: Split Program-Footnote-1684645
-Node: Tee Program684773
-Node: Uniq Program687576
-Node: Wc Program695005
-Ref: Wc Program-Footnote-1699271
-Ref: Wc Program-Footnote-2699471
-Node: Miscellaneous Programs699563
-Node: Dupword Program700751
-Node: Alarm Program702782
-Node: Translate Program707531
-Ref: Translate Program-Footnote-1711918
-Ref: Translate Program-Footnote-2712146
-Node: Labels Program712280
-Ref: Labels Program-Footnote-1715651
-Node: Word Sorting715735
-Node: History Sorting719619
-Node: Extract Program721458
-Ref: Extract Program-Footnote-1728941
-Node: Simple Sed729069
-Node: Igawk Program732131
-Ref: Igawk Program-Footnote-1747288
-Ref: Igawk Program-Footnote-2747489
-Node: Anagram Program747627
-Node: Signature Program750695
-Node: Debugger751795
-Node: Debugging752706
-Node: Debugging Concepts753119
-Node: Debugging Terms754975
-Node: Awk Debugging757598
-Node: Sample dgawk session758490
-Node: dgawk invocation758982
-Node: Finding The Bug760164
-Node: List of Debugger Commands766650
-Node: Breakpoint Control767961
-Node: Dgawk Execution Control771597
-Node: Viewing And Changing Data774948
-Node: Dgawk Stack778285
-Node: Dgawk Info779745
-Node: Miscellaneous Dgawk Commands783693
-Node: Readline Support789121
-Node: Dgawk Limitations789959
-Node: Language History792148
-Node: V7/SVR3.1793660
-Node: SVR4795981
-Node: POSIX797423
-Node: BTL798431
-Node: POSIX/GNU799165
-Node: Common Extensions804316
-Node: Ranges and Locales805423
-Ref: Ranges and Locales-Footnote-1810041
-Ref: Ranges and Locales-Footnote-2810068
-Ref: Ranges and Locales-Footnote-3810328
-Node: Contributors810549
-Node: Installation814811
-Node: Gawk Distribution815705
-Node: Getting816189
-Node: Extracting817015
-Node: Distribution contents818707
-Node: Unix Installation823929
-Node: Quick Installation824546
-Node: Additional Configuration Options826508
-Node: Configuration Philosophy827985
-Node: Non-Unix Installation830327
-Node: PC Installation830785
-Node: PC Binary Installation832084
-Node: PC Compiling834099
-Node: PC Testing837043
-Node: PC Using838219
-Node: Cygwin842404
-Node: MSYS843404
-Node: VMS Installation843918
-Node: VMS Compilation844521
-Ref: VMS Compilation-Footnote-1845528
-Node: VMS Installation Details845586
-Node: VMS Running847221
-Node: VMS Old Gawk848828
-Node: Bugs849302
-Node: Other Versions853154
-Node: Notes858435
-Node: Compatibility Mode859127
-Node: Additions859910
-Node: Accessing The Source860722
-Node: Adding Code862147
-Node: New Ports868114
-Node: Dynamic Extensions872227
-Node: Internals873603
-Node: Plugin License882706
-Node: Sample Library883340
-Node: Internal File Description884026
-Node: Internal File Ops887741
-Ref: Internal File Ops-Footnote-1892522
-Node: Using Internal File Ops892662
-Node: Future Extensions895039
-Node: Basic Concepts897543
-Node: Basic High Level898300
-Ref: Basic High Level-Footnote-1902335
-Node: Basic Data Typing902520
-Node: Floating Point Issues907045
-Node: String Conversion Precision908128
-Ref: String Conversion Precision-Footnote-1909828
-Node: Unexpected Results909937
-Node: POSIX Floating Point Problems911763
-Ref: POSIX Floating Point Problems-Footnote-1915468
-Node: Glossary915506
-Node: Copying940482
-Node: GNU Free Documentation License978039
-Node: Index1003176
+Node: Exit Statement381317
+Node: Built-in Variables383733
+Node: User-modified384828
+Ref: User-modified-Footnote-1392854
+Node: Auto-set392916
+Ref: Auto-set-Footnote-1402207
+Node: ARGC and ARGV402412
+Node: Arrays406263
+Node: Array Basics407768
+Node: Array Intro408594
+Node: Reference to Elements412912
+Node: Assigning Elements415182
+Node: Array Example415673
+Node: Scanning an Array417405
+Node: Controlling Scanning419719
+Ref: Controlling Scanning-Footnote-1424652
+Node: Delete424968
+Ref: Delete-Footnote-1427733
+Node: Numeric Array Subscripts427790
+Node: Uninitialized Subscripts429973
+Node: Multi-dimensional431601
+Node: Multi-scanning434695
+Node: Arrays of Arrays436286
+Node: Functions440931
+Node: Built-in441753
+Node: Calling Built-in442831
+Node: Numeric Functions444819
+Ref: Numeric Functions-Footnote-1448651
+Ref: Numeric Functions-Footnote-2449008
+Ref: Numeric Functions-Footnote-3449056
+Node: String Functions449325
+Ref: String Functions-Footnote-1472822
+Ref: String Functions-Footnote-2472951
+Ref: String Functions-Footnote-3473199
+Node: Gory Details473286
+Ref: table-sub-escapes474965
+Ref: table-sub-posix-92476319
+Ref: table-sub-proposed477662
+Ref: table-posix-sub479012
+Ref: table-gensub-escapes480558
+Ref: Gory Details-Footnote-1481765
+Ref: Gory Details-Footnote-2481816
+Node: I/O Functions481967
+Ref: I/O Functions-Footnote-1488622
+Node: Time Functions488769
+Ref: Time Functions-Footnote-1499661
+Ref: Time Functions-Footnote-2499729
+Ref: Time Functions-Footnote-3499887
+Ref: Time Functions-Footnote-4499998
+Ref: Time Functions-Footnote-5500110
+Ref: Time Functions-Footnote-6500337
+Node: Bitwise Functions500603
+Ref: table-bitwise-ops501161
+Ref: Bitwise Functions-Footnote-1505321
+Node: Type Functions505505
+Node: I18N Functions505975
+Node: User-defined507602
+Node: Definition Syntax508406
+Ref: Definition Syntax-Footnote-1513316
+Node: Function Example513385
+Node: Function Caveats515979
+Node: Calling A Function516400
+Node: Variable Scope517515
+Node: Pass By Value/Reference519490
+Node: Return Statement522930
+Node: Dynamic Typing525911
+Node: Indirect Calls526646
+Node: Internationalization536331
+Node: I18N and L10N537757
+Node: Explaining gettext538443
+Ref: Explaining gettext-Footnote-1543509
+Ref: Explaining gettext-Footnote-2543693
+Node: Programmer i18n543858
+Node: Translator i18n548058
+Node: String Extraction548851
+Ref: String Extraction-Footnote-1549812
+Node: Printf Ordering549898
+Ref: Printf Ordering-Footnote-1552682
+Node: I18N Portability552746
+Ref: I18N Portability-Footnote-1555195
+Node: I18N Example555258
+Ref: I18N Example-Footnote-1557893
+Node: Gawk I18N557965
+Node: Advanced Features558582
+Node: Nondecimal Data560095
+Node: Array Sorting561678
+Node: Controlling Array Traversal562375
+Node: Array Sorting Functions570612
+Ref: Array Sorting Functions-Footnote-1574286
+Ref: Array Sorting Functions-Footnote-2574379
+Node: Two-way I/O574573
+Ref: Two-way I/O-Footnote-1580005
+Node: TCP/IP Networking580075
+Node: Profiling582919
+Node: Library Functions590393
+Ref: Library Functions-Footnote-1593400
+Node: Library Names593571
+Ref: Library Names-Footnote-1597042
+Ref: Library Names-Footnote-2597262
+Node: General Functions597348
+Node: Strtonum Function598301
+Node: Assert Function601231
+Node: Round Function604557
+Node: Cliff Random Function606100
+Node: Ordinal Functions607116
+Ref: Ordinal Functions-Footnote-1610186
+Ref: Ordinal Functions-Footnote-2610438
+Node: Join Function610647
+Ref: Join Function-Footnote-1612418
+Node: Gettimeofday Function612618
+Node: Data File Management616333
+Node: Filetrans Function616965
+Node: Rewind Function621104
+Node: File Checking622491
+Node: Empty Files623585
+Node: Ignoring Assigns625815
+Node: Getopt Function627368
+Ref: Getopt Function-Footnote-1638672
+Node: Passwd Functions638875
+Ref: Passwd Functions-Footnote-1647850
+Node: Group Functions647938
+Node: Walking Arrays656022
+Node: Sample Programs657591
+Node: Running Examples658256
+Node: Clones658984
+Node: Cut Program660208
+Node: Egrep Program670053
+Ref: Egrep Program-Footnote-1677826
+Node: Id Program677936
+Node: Split Program681552
+Ref: Split Program-Footnote-1685071
+Node: Tee Program685199
+Node: Uniq Program688002
+Node: Wc Program695431
+Ref: Wc Program-Footnote-1699697
+Ref: Wc Program-Footnote-2699897
+Node: Miscellaneous Programs699989
+Node: Dupword Program701177
+Node: Alarm Program703208
+Node: Translate Program707957
+Ref: Translate Program-Footnote-1712344
+Ref: Translate Program-Footnote-2712572
+Node: Labels Program712706
+Ref: Labels Program-Footnote-1716077
+Node: Word Sorting716161
+Node: History Sorting720045
+Node: Extract Program721884
+Ref: Extract Program-Footnote-1729367
+Node: Simple Sed729495
+Node: Igawk Program732557
+Ref: Igawk Program-Footnote-1747714
+Ref: Igawk Program-Footnote-2747915
+Node: Anagram Program748053
+Node: Signature Program751121
+Node: Debugger752221
+Node: Debugging753132
+Node: Debugging Concepts753545
+Node: Debugging Terms755401
+Node: Awk Debugging758024
+Node: Sample dgawk session758916
+Node: dgawk invocation759408
+Node: Finding The Bug760590
+Node: List of Debugger Commands767076
+Node: Breakpoint Control768387
+Node: Dgawk Execution Control772023
+Node: Viewing And Changing Data775374
+Node: Dgawk Stack778711
+Node: Dgawk Info780171
+Node: Miscellaneous Dgawk Commands784119
+Node: Readline Support789547
+Node: Dgawk Limitations790385
+Node: Language History792574
+Node: V7/SVR3.1794086
+Node: SVR4796407
+Node: POSIX797849
+Node: BTL798857
+Node: POSIX/GNU799591
+Node: Common Extensions804742
+Node: Ranges and Locales805849
+Ref: Ranges and Locales-Footnote-1810467
+Ref: Ranges and Locales-Footnote-2810494
+Ref: Ranges and Locales-Footnote-3810754
+Node: Contributors810975
+Node: Installation815237
+Node: Gawk Distribution816131
+Node: Getting816615
+Node: Extracting817441
+Node: Distribution contents819133
+Node: Unix Installation824355
+Node: Quick Installation824972
+Node: Additional Configuration Options826934
+Node: Configuration Philosophy828411
+Node: Non-Unix Installation830753
+Node: PC Installation831211
+Node: PC Binary Installation832510
+Node: PC Compiling834525
+Node: PC Testing837469
+Node: PC Using838645
+Node: Cygwin842830
+Node: MSYS843830
+Node: VMS Installation844344
+Node: VMS Compilation844947
+Ref: VMS Compilation-Footnote-1845954
+Node: VMS Installation Details846012
+Node: VMS Running847647
+Node: VMS Old Gawk849254
+Node: Bugs849728
+Node: Other Versions853580
+Node: Notes858861
+Node: Compatibility Mode859553
+Node: Additions860336
+Node: Accessing The Source861148
+Node: Adding Code862573
+Node: New Ports868540
+Node: Dynamic Extensions872653
+Node: Internals874029
+Node: Plugin License883132
+Node: Sample Library883766
+Node: Internal File Description884452
+Node: Internal File Ops888167
+Ref: Internal File Ops-Footnote-1892948
+Node: Using Internal File Ops893088
+Node: Future Extensions895465
+Node: Basic Concepts897969
+Node: Basic High Level898726
+Ref: Basic High Level-Footnote-1902761
+Node: Basic Data Typing902946
+Node: Floating Point Issues907471
+Node: String Conversion Precision908554
+Ref: String Conversion Precision-Footnote-1910254
+Node: Unexpected Results910363
+Node: POSIX Floating Point Problems912189
+Ref: POSIX Floating Point Problems-Footnote-1915894
+Node: Glossary915932
+Node: Copying940908
+Node: GNU Free Documentation License978465
+Node: Index1003602

End Tag Table