diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-10-20 19:51:40 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-10-20 19:51:40 +0300 |
commit | fc1c85bd36910c9ef743db07022055e2d417c21b (patch) | |
tree | a927a5493bcfb9793a540a9ad874b796f75eb687 | |
parent | 3d6d06827c2a84b5b3a22de5b546857b3c3991e1 (diff) | |
parent | b8c16c0893bc1be06244387fb5f8db54f0b1578d (diff) | |
download | egawk-fc1c85bd36910c9ef743db07022055e2d417c21b.tar.gz egawk-fc1c85bd36910c9ef743db07022055e2d417c21b.tar.bz2 egawk-fc1c85bd36910c9ef743db07022055e2d417c21b.zip |
Merge branch 'gawk-5.1-stable'
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 1273 | ||||
-rw-r--r-- | doc/gawk.texi | 34 | ||||
-rw-r--r-- | doc/gawktexi.in | 34 | ||||
-rw-r--r-- | msg.c | 2 | ||||
-rw-r--r-- | pc/ChangeLog | 4 | ||||
-rw-r--r-- | pc/Makefile.tst | 5 |
8 files changed, 744 insertions, 618 deletions
@@ -1,3 +1,8 @@ +2021-10-20 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * msg.c (err): Need to check that FNR_node->var_value is non-NULL + before testing with is_mpg_number. + 2021-10-18 Arnold D. Robbins <arnold@skeeve.com> Factor duplicated code out into a separate function. diff --git a/doc/ChangeLog b/doc/ChangeLog index cfb55b4c..e30a2afa 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2021-10-20 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (FS versus FPAT): New subsection. + (String Functions): Reference it. + 2021-10-13 Arnold D. Robbins <arnold@skeeve.com> * awkcard.in, gawkinet.texi, gawkworkflow.texi: Update copyright year. diff --git a/doc/gawk.info b/doc/gawk.info index 29209ebf..de53a993 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -205,6 +205,7 @@ in (a) below. A copy of the license is included in the section entitled * Fields with fixed data:: Field values with fixed-width data. * Splitting By Content:: Defining Fields By Content * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. * Testing field creation:: Checking how 'gawk' is splitting records. * Multiple Line:: Reading multiline records. @@ -5593,6 +5594,7 @@ File: gawk.info, Node: Splitting By Content, Next: Testing field creation, Pr * Menu: * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. This minor node discusses an advanced feature of 'gawk'. If you are a novice 'awk' user, you might want to skip it on the first reading. @@ -5691,7 +5693,7 @@ years. RFC 4180 (http://www.ietf.org/rfc/rfc4180.txt) standardizes the most common practices. -File: gawk.info, Node: More CSV, Up: Splitting By Content +File: gawk.info, Node: More CSV, Next: FS versus FPAT, Up: Splitting By Content 4.7.1 More on CSV Files ----------------------- @@ -5748,6 +5750,33 @@ that isn't covered. We recommend, instead, that you use Manuel Collado's 'CSVMODE' library for 'gawk' (http://mcollado.z15.es/xgawk/). +File: gawk.info, Node: FS versus FPAT, Prev: More CSV, Up: Splitting By Content + +4.7.2 'FS' Versus 'FPAT': A Subtle Difference +--------------------------------------------- + +As we discussed earlier, 'FS' describes the data between fields ("what +fields are not") and 'FPAT' describes the fields themselves ("what +fields are"). This leads to a subtle difference in how fields are found +when using regexps as the value for 'FS' or 'FPAT'. + + In order to distinguish one field from another, there must be a +non-empty separator between each field. This makes intuitive +sense--otherwise one could not distinguish fields from separators. + + Thus, regular expression matching as done when splitting fields with +'FS' is not allowed to match the null string; it must always match at +least one character, in order to be able to proceed through the entire +record. + + On the other hand, regular expression matching with 'FPAT' can match +the null string, and the non-matching intervening characters function as +the separators. + + This same difference is reflected in how matching is done with the +'split()' and 'patsplit()' functions (*note String Functions::). + + File: gawk.info, Node: Testing field creation, Next: Multiple Line, Prev: Splitting By Content, Up: Reading Files 4.8 Checking How 'gawk' Is Splitting Records @@ -13579,6 +13608,15 @@ Options::): Nonalphabetic characters are left unchanged. For example, 'toupper("MiXeD cAsE 123")' returns '"MIXED CASE 123"'. + At first glance, the 'split()' and 'patsplit()' functions appear to +be mirror images of each other. But there are differences: + + * 'split()' treats its third argument like 'FS', with all the special + rules involved for 'FS'. + + * Matching of null strings differs. This is discussed in *note FS + versus FPAT::. + Matching the Null String In 'awk', the '*' operator can match the null string. This is @@ -35189,7 +35227,7 @@ Index * * (asterisk), *= operator <1>: Precedence. (line 94) * * (asterisk), **= operator <1>: Precedence. (line 94) * * (asterisk), * operator, null strings, matching: String Functions. - (line 556) + (line 565) * + (plus sign), regexp operator: Regexp Operator Details. (line 107) * + (plus sign), += operator: Assignment Ops. (line 81) @@ -35478,7 +35516,7 @@ Index * adding, features to gawk: Adding Code. (line 6) * advanced features, fixed-width data: Constant Size. (line 6) * advanced features, specifying field content: Splitting By Content. - (line 13) + (line 14) * advanced features, gawk: Advanced Features. (line 6) * advanced features, nondecimal input data: Nondecimal Data. (line 6) * advanced features, processes, communicating with: Two-way I/O. @@ -35630,7 +35668,7 @@ Index * asterisk (*), *= operator <1>: Precedence. (line 94) * asterisk (*), **= operator <1>: Precedence. (line 94) * asterisk (*), * operator, null strings, matching: String Functions. - (line 556) + (line 565) * at-sign (@), @include directive: Include Files. (line 8) * at-sign (@), @load directive: Loading Shared Libraries. (line 8) @@ -35987,7 +36025,7 @@ Index * columns, cutting: Cut Program. (line 6) * comma (,), in range patterns: Ranges. (line 6) * Comma separated values (CSV) data, parsing with FPAT: Splitting By Content. - (line 19) + (line 20) * Comma separated values (CSV) data, parsing with FPAT library: More CSV. (line 52) * command completion, in debugger: Readline Support. (line 6) @@ -36106,7 +36144,7 @@ Index * csh utility, POSIXLY_CORRECT environment variable: Options. (line 406) * csh utility, |& operator, comparison with: Two-way I/O. (line 27) * CSV (comma separated values) data, parsing with FPAT: Splitting By Content. - (line 19) + (line 20) * CSV (comma separated values) data, parsing with CSVMODE library: More CSV. (line 52) * CSVMODE library for gawk: More CSV. (line 52) @@ -36816,7 +36854,7 @@ Index * forward slash (/), /= operator <1>: Precedence. (line 94) * forward slash (/), patterns and: Expression Patterns. (line 24) * FPAT variable: Splitting By Content. - (line 29) + (line 30) * FPAT variable <1>: User-modified. (line 46) * frame debugger command: Execution Stack. (line 27) * frawk: Other Versions. (line 117) @@ -36927,7 +36965,7 @@ Index * gawk, RT variable in <1>: gawk split records. (line 66) * gawk, FIELDWIDTHS variable in: Fixed width data. (line 17) * gawk, FPAT variable in: Splitting By Content. - (line 29) + (line 30) * gawk, splitting fields and: Testing field creation. (line 6) * gawk, RT variable in <2>: Multiple Line. (line 139) @@ -37399,7 +37437,7 @@ Index * matching, leftmost longest: Multiple Line. (line 26) * matching, expressions: Typing and Comparison. (line 9) -* matching, null strings: String Functions. (line 556) +* matching, null strings: String Functions. (line 565) * mawk utility: Escape Sequences. (line 121) * mawk utility <1>: Getline/Pipe. (line 62) * mawk utility <2>: Concatenation. (line 36) @@ -37529,7 +37567,7 @@ Index * null strings, as array subscripts: Uninitialized Subscripts. (line 43) * null strings, deleting array elements and: Delete. (line 27) -* null strings, matching: String Functions. (line 556) +* null strings, matching: String Functions. (line 565) * null strings <3>: Basic Data Typing. (line 26) * number of array elements: String Functions. (line 215) * number sign (#), #! (executable scripts): Executable Scripts. @@ -38200,7 +38238,7 @@ Index (line 147) * sidebar, Operator Evaluation Order: Increment Ops. (line 58) * sidebar, Changing NR and FNR: Auto-set. (line 407) -* sidebar, Matching the Null String: String Functions. (line 554) +* sidebar, Matching the Null String: String Functions. (line 563) * sidebar, Interactive Versus Noninteractive Buffering: I/O Functions. (line 74) * sidebar, Controlling Output Buffering with system(): I/O Functions. @@ -38649,612 +38687,613 @@ Index Tag Table: Node: Top1200 -Node: Foreword345523 -Node: Foreword449965 -Node: Preface51497 -Ref: Preface-Footnote-154356 -Ref: Preface-Footnote-254465 -Ref: Preface-Footnote-354699 -Node: History54841 -Node: Names57193 -Ref: Names-Footnote-158297 -Node: This Manual58444 -Ref: This Manual-Footnote-165083 -Node: Conventions65183 -Node: Manual History67552 -Ref: Manual History-Footnote-170549 -Ref: Manual History-Footnote-270590 -Node: How To Contribute70664 -Node: Acknowledgments71590 -Node: Getting Started76527 -Node: Running gawk78966 -Node: One-shot80156 -Node: Read Terminal81419 -Node: Long83412 -Node: Executable Scripts84925 -Ref: Executable Scripts-Footnote-187558 -Node: Comments87661 -Node: Quoting90145 -Node: DOS Quoting95671 -Node: Sample Data Files97727 -Node: Very Simple100322 -Node: Two Rules106424 -Node: More Complex108309 -Node: Statements/Lines110641 -Ref: Statements/Lines-Footnote-1115125 -Node: Other Features115390 -Node: When116326 -Ref: When-Footnote-1118080 -Node: Intro Summary118145 -Node: Invoking Gawk119029 -Node: Command Line120543 -Node: Options121341 -Ref: Options-Footnote-1139255 -Ref: Options-Footnote-2139486 -Node: Other Arguments139511 -Node: Naming Standard Input143522 -Node: Environment Variables144732 -Node: AWKPATH Variable145290 -Ref: AWKPATH Variable-Footnote-1148702 -Ref: AWKPATH Variable-Footnote-2148736 -Node: AWKLIBPATH Variable149107 -Ref: AWKLIBPATH Variable-Footnote-1150804 -Node: Other Environment Variables151179 -Node: Exit Status155131 -Node: Include Files155808 -Node: Loading Shared Libraries159498 -Node: Obsolete160926 -Node: Undocumented161618 -Node: Invoking Summary161915 -Node: Regexp164756 -Node: Regexp Usage166210 -Node: Escape Sequences168247 -Node: Regexp Operators174488 -Node: Regexp Operator Details174973 -Ref: Regexp Operator Details-Footnote-1182337 -Node: Interval Expressions182484 -Ref: Interval Expressions-Footnote-1184684 -Node: Bracket Expressions184782 -Ref: table-char-classes187258 -Node: Leftmost Longest190584 -Node: Computed Regexps191887 -Node: GNU Regexp Operators195314 -Node: Case-sensitivity199051 -Ref: Case-sensitivity-Footnote-1201917 -Ref: Case-sensitivity-Footnote-2202152 -Node: Regexp Summary202260 -Node: Reading Files203726 -Node: Records205995 -Node: awk split records207070 -Node: gawk split records211770 -Ref: gawk split records-Footnote-1216844 -Node: Fields216881 -Node: Nonconstant Fields219622 -Ref: Nonconstant Fields-Footnote-1221858 -Node: Changing Fields222062 -Node: Field Separators228093 -Node: Default Field Splitting230791 -Node: Regexp Field Splitting231909 -Node: Single Character Fields235586 -Node: Command Line Field Separator236646 -Node: Full Line Fields239864 -Ref: Full Line Fields-Footnote-1241386 -Ref: Full Line Fields-Footnote-2241432 -Node: Field Splitting Summary241533 -Node: Constant Size243607 -Node: Fixed width data244339 -Node: Skipping intervening247806 -Node: Allowing trailing data248604 -Node: Fields with fixed data249641 -Node: Splitting By Content251159 -Ref: Splitting By Content-Footnote-1254942 -Node: More CSV255105 -Node: Testing field creation256697 -Node: Multiple Line258322 -Node: Getline264599 -Node: Plain Getline267068 -Node: Getline/Variable269641 -Node: Getline/File270792 -Node: Getline/Variable/File272180 -Ref: Getline/Variable/File-Footnote-1273785 -Node: Getline/Pipe273873 -Node: Getline/Variable/Pipe276577 -Node: Getline/Coprocess277712 -Node: Getline/Variable/Coprocess278979 -Node: Getline Notes279721 -Node: Getline Summary282518 -Ref: table-getline-variants282942 -Node: Read Timeout283690 -Ref: Read Timeout-Footnote-1287596 -Node: Retrying Input287654 -Node: Command-line directories288853 -Node: Input Summary289759 -Node: Input Exercises292931 -Node: Printing293365 -Node: Print295199 -Node: Print Examples296656 -Node: Output Separators299436 -Node: OFMT301453 -Node: Printf302809 -Node: Basic Printf303594 -Node: Control Letters305168 -Node: Format Modifiers310330 -Node: Printf Examples316345 -Node: Redirection318831 -Node: Special FD325672 -Ref: Special FD-Footnote-1328840 -Node: Special Files328914 -Node: Other Inherited Files329531 -Node: Special Network330532 -Node: Special Caveats331392 -Node: Close Files And Pipes332341 -Ref: table-close-pipe-return-values339248 -Ref: Close Files And Pipes-Footnote-1340061 -Ref: Close Files And Pipes-Footnote-2340209 -Node: Nonfatal340361 -Node: Output Summary342699 -Node: Output Exercises343921 -Node: Expressions344600 -Node: Values345788 -Node: Constants346466 -Node: Scalar Constants347157 -Ref: Scalar Constants-Footnote-1349667 -Node: Nondecimal-numbers349917 -Node: Regexp Constants352918 -Node: Using Constant Regexps353444 -Node: Standard Regexp Constants354066 -Node: Strong Regexp Constants357254 -Node: Variables360967 -Node: Using Variables361624 -Node: Assignment Options363534 -Node: Conversion366005 -Node: Strings And Numbers366529 -Ref: Strings And Numbers-Footnote-1369592 -Node: Locale influences conversions369701 -Ref: table-locale-affects372459 -Node: All Operators373077 -Node: Arithmetic Ops373706 -Node: Concatenation376422 -Ref: Concatenation-Footnote-1379269 -Node: Assignment Ops379376 -Ref: table-assign-ops384367 -Node: Increment Ops385680 -Node: Truth Values and Conditions389140 -Node: Truth Values390214 -Node: Typing and Comparison391262 -Node: Variable Typing392082 -Ref: Variable Typing-Footnote-1398545 -Ref: Variable Typing-Footnote-2398617 -Node: Comparison Operators398694 -Ref: table-relational-ops399113 -Node: POSIX String Comparison402608 -Ref: POSIX String Comparison-Footnote-1404303 -Ref: POSIX String Comparison-Footnote-2404442 -Node: Boolean Ops404526 -Ref: Boolean Ops-Footnote-1409008 -Node: Conditional Exp409100 -Node: Function Calls410836 -Node: Precedence414713 -Node: Locales418372 -Node: Expressions Summary420004 -Node: Patterns and Actions422577 -Node: Pattern Overview423697 -Node: Regexp Patterns425374 -Node: Expression Patterns425916 -Node: Ranges429697 -Node: BEGIN/END432805 -Node: Using BEGIN/END433566 -Ref: Using BEGIN/END-Footnote-1436320 -Node: I/O And BEGIN/END436426 -Node: BEGINFILE/ENDFILE438739 -Node: Empty441970 -Node: Using Shell Variables442287 -Node: Action Overview444561 -Node: Statements446886 -Node: If Statement448734 -Node: While Statement450229 -Node: Do Statement452257 -Node: For Statement453405 -Node: Switch Statement456660 -Node: Break Statement459101 -Node: Continue Statement461193 -Node: Next Statement463020 -Node: Nextfile Statement465403 -Node: Exit Statement468092 -Node: Built-in Variables470495 -Node: User-modified471628 -Node: Auto-set479395 -Ref: Auto-set-Footnote-1496202 -Ref: Auto-set-Footnote-2496408 -Node: ARGC and ARGV496464 -Node: Pattern Action Summary500677 -Node: Arrays503107 -Node: Array Basics504436 -Node: Array Intro505280 -Ref: figure-array-elements507255 -Ref: Array Intro-Footnote-1509959 -Node: Reference to Elements510087 -Node: Assigning Elements512551 -Node: Array Example513042 -Node: Scanning an Array514801 -Node: Controlling Scanning517823 -Ref: Controlling Scanning-Footnote-1524279 -Node: Numeric Array Subscripts524595 -Node: Uninitialized Subscripts526779 -Node: Delete528398 -Ref: Delete-Footnote-1531150 -Node: Multidimensional531207 -Node: Multiscanning534302 -Node: Arrays of Arrays535893 -Node: Arrays Summary540661 -Node: Functions542754 -Node: Built-in543792 -Node: Calling Built-in544945 -Node: Boolean Functions546941 -Node: Numeric Functions547495 -Ref: Numeric Functions-Footnote-1551522 -Ref: Numeric Functions-Footnote-2552170 -Ref: Numeric Functions-Footnote-3552218 -Node: String Functions552490 -Ref: String Functions-Footnote-1577005 -Ref: String Functions-Footnote-2577133 -Ref: String Functions-Footnote-3577381 -Node: Gory Details577468 -Ref: table-sub-escapes579259 -Ref: table-sub-proposed580778 -Ref: table-posix-sub582141 -Ref: table-gensub-escapes583682 -Ref: Gory Details-Footnote-1584505 -Node: I/O Functions584659 -Ref: table-system-return-values591113 -Ref: I/O Functions-Footnote-1593193 -Ref: I/O Functions-Footnote-2593341 -Node: Time Functions593461 -Ref: Time Functions-Footnote-1604132 -Ref: Time Functions-Footnote-2604200 -Ref: Time Functions-Footnote-3604358 -Ref: Time Functions-Footnote-4604469 -Ref: Time Functions-Footnote-5604581 -Ref: Time Functions-Footnote-6604808 -Node: Bitwise Functions605074 -Ref: table-bitwise-ops605668 -Ref: Bitwise Functions-Footnote-1611731 -Ref: Bitwise Functions-Footnote-2611904 -Node: Type Functions612095 -Node: I18N Functions615515 -Node: User-defined617166 -Node: Definition Syntax617978 -Ref: Definition Syntax-Footnote-1623672 -Node: Function Example623743 -Ref: Function Example-Footnote-1626665 -Node: Function Calling626687 -Node: Calling A Function627275 -Node: Variable Scope628233 -Node: Pass By Value/Reference631227 -Node: Function Caveats633871 -Ref: Function Caveats-Footnote-1635918 -Node: Return Statement636038 -Node: Dynamic Typing639017 -Node: Indirect Calls639947 -Ref: Indirect Calls-Footnote-1650202 -Node: Functions Summary650330 -Node: Library Functions653035 -Ref: Library Functions-Footnote-1656642 -Ref: Library Functions-Footnote-2656785 -Node: Library Names656956 -Ref: Library Names-Footnote-1660623 -Ref: Library Names-Footnote-2660846 -Node: General Functions660932 -Node: Strtonum Function662114 -Node: Assert Function665136 -Node: Round Function668462 -Node: Cliff Random Function670002 -Node: Ordinal Functions671018 -Ref: Ordinal Functions-Footnote-1674081 -Ref: Ordinal Functions-Footnote-2674333 -Node: Join Function674543 -Ref: Join Function-Footnote-1676313 -Node: Getlocaltime Function676513 -Node: Readfile Function680255 -Node: Shell Quoting682232 -Node: Isnumeric Function683660 -Node: Data File Management685048 -Node: Filetrans Function685680 -Node: Rewind Function689776 -Node: File Checking691685 -Ref: File Checking-Footnote-1693019 -Node: Empty Files693220 -Node: Ignoring Assigns695199 -Node: Getopt Function696749 -Ref: Getopt Function-Footnote-1711972 -Node: Passwd Functions712172 -Ref: Passwd Functions-Footnote-1721011 -Node: Group Functions721099 -Ref: Group Functions-Footnote-1728997 -Node: Walking Arrays729204 -Node: Library Functions Summary732212 -Node: Library Exercises733618 -Node: Sample Programs734083 -Node: Running Examples734853 -Node: Clones735581 -Node: Cut Program736805 -Node: Egrep Program746945 -Node: Id Program755946 -Node: Split Program765881 -Ref: Split Program-Footnote-1775774 -Node: Tee Program775947 -Node: Uniq Program778737 -Node: Wc Program786325 -Node: Bytes vs. Characters786712 -Node: Using extensions788260 -Node: wc program789014 -Node: Miscellaneous Programs793879 -Node: Dupword Program795092 -Node: Alarm Program797122 -Node: Translate Program801977 -Ref: Translate Program-Footnote-1806542 -Node: Labels Program806812 -Ref: Labels Program-Footnote-1810163 -Node: Word Sorting810247 -Node: History Sorting814319 -Node: Extract Program816544 -Node: Simple Sed824598 -Node: Igawk Program827672 -Ref: Igawk Program-Footnote-1842003 -Ref: Igawk Program-Footnote-2842205 -Ref: Igawk Program-Footnote-3842327 -Node: Anagram Program842442 -Node: Signature Program845504 -Node: Programs Summary846751 -Node: Programs Exercises847965 -Ref: Programs Exercises-Footnote-1852095 -Node: Advanced Features852181 -Node: Nondecimal Data854312 -Node: Boolean Typed Values855910 -Node: Array Sorting857791 -Node: Controlling Array Traversal858496 -Ref: Controlling Array Traversal-Footnote-1866864 -Node: Array Sorting Functions866982 -Ref: Array Sorting Functions-Footnote-1872356 -Node: Two-way I/O872552 -Ref: Two-way I/O-Footnote-1880278 -Ref: Two-way I/O-Footnote-2880465 -Node: TCP/IP Networking880547 -Node: Profiling883665 -Node: Extension Philosophy892974 -Node: Advanced Features Summary894453 -Node: Internationalization896468 -Node: I18N and L10N898142 -Node: Explaining gettext898829 -Ref: Explaining gettext-Footnote-1904721 -Ref: Explaining gettext-Footnote-2904906 -Node: Programmer i18n905071 -Ref: Programmer i18n-Footnote-1910020 -Node: Translator i18n910069 -Node: String Extraction910863 -Ref: String Extraction-Footnote-1911995 -Node: Printf Ordering912081 -Ref: Printf Ordering-Footnote-1914867 -Node: I18N Portability914931 -Ref: I18N Portability-Footnote-1917387 -Node: I18N Example917450 -Ref: I18N Example-Footnote-1920725 -Ref: I18N Example-Footnote-2920798 -Node: Gawk I18N920907 -Node: I18N Summary921556 -Node: Debugger922897 -Node: Debugging923897 -Node: Debugging Concepts924338 -Node: Debugging Terms926147 -Node: Awk Debugging928722 -Ref: Awk Debugging-Footnote-1929667 -Node: Sample Debugging Session929799 -Node: Debugger Invocation930333 -Node: Finding The Bug931719 -Node: List of Debugger Commands938193 -Node: Breakpoint Control939526 -Node: Debugger Execution Control943220 -Node: Viewing And Changing Data946582 -Node: Execution Stack950123 -Node: Debugger Info951760 -Node: Miscellaneous Debugger Commands955831 -Node: Readline Support960893 -Node: Limitations961789 -Node: Debugging Summary964343 -Node: Namespaces965622 -Node: Global Namespace966733 -Node: Qualified Names968131 -Node: Default Namespace969130 -Node: Changing The Namespace969871 -Node: Naming Rules971485 -Node: Internal Name Management973333 -Node: Namespace Example974375 -Node: Namespace And Features976937 -Node: Namespace Summary978372 -Node: Arbitrary Precision Arithmetic979849 -Node: Computer Arithmetic981336 -Ref: table-numeric-ranges985102 -Ref: table-floating-point-ranges985595 -Ref: Computer Arithmetic-Footnote-1986253 -Node: Math Definitions986310 -Ref: table-ieee-formats989286 -Node: MPFR features989853 -Node: FP Math Caution991571 -Ref: FP Math Caution-Footnote-1992643 -Node: Inexactness of computations993012 -Node: Inexact representation994043 -Node: Comparing FP Values995403 -Node: Errors accumulate996644 -Node: Strange values998100 -Ref: Strange values-Footnote-11000688 -Node: Getting Accuracy1000793 -Node: Try To Round1003503 -Node: Setting precision1004402 -Ref: table-predefined-precision-strings1005099 -Node: Setting the rounding mode1006929 -Ref: table-gawk-rounding-modes1007303 -Ref: Setting the rounding mode-Footnote-11011234 -Node: Arbitrary Precision Integers1011413 -Ref: Arbitrary Precision Integers-Footnote-11014588 -Node: Checking for MPFR1014737 -Node: POSIX Floating Point Problems1016211 -Ref: POSIX Floating Point Problems-Footnote-11020496 -Node: Floating point summary1020534 -Node: Dynamic Extensions1022724 -Node: Extension Intro1024277 -Node: Plugin License1025543 -Node: Extension Mechanism Outline1026340 -Ref: figure-load-extension1026779 -Ref: figure-register-new-function1028344 -Ref: figure-call-new-function1029436 -Node: Extension API Description1031498 -Node: Extension API Functions Introduction1033211 -Ref: table-api-std-headers1035047 -Node: General Data Types1039296 -Ref: General Data Types-Footnote-11048002 -Node: Memory Allocation Functions1048301 -Ref: Memory Allocation Functions-Footnote-11052802 -Node: Constructor Functions1052901 -Node: API Ownership of MPFR and GMP Values1056554 -Node: Registration Functions1057867 -Node: Extension Functions1058567 -Node: Exit Callback Functions1063889 -Node: Extension Version String1065139 -Node: Input Parsers1065802 -Node: Output Wrappers1078523 -Node: Two-way processors1083035 -Node: Printing Messages1085300 -Ref: Printing Messages-Footnote-11086471 -Node: Updating ERRNO1086624 -Node: Requesting Values1087363 -Ref: table-value-types-returned1088100 -Node: Accessing Parameters1089208 -Node: Symbol Table Access1090445 -Node: Symbol table by name1090957 -Ref: Symbol table by name-Footnote-11093982 -Node: Symbol table by cookie1094110 -Ref: Symbol table by cookie-Footnote-11098295 -Node: Cached values1098359 -Ref: Cached values-Footnote-11101895 -Node: Array Manipulation1102048 -Ref: Array Manipulation-Footnote-11103139 -Node: Array Data Types1103176 -Ref: Array Data Types-Footnote-11105834 -Node: Array Functions1105926 -Node: Flattening Arrays1110424 -Node: Creating Arrays1117400 -Node: Redirection API1122167 -Node: Extension API Variables1125000 -Node: Extension Versioning1125711 -Ref: gawk-api-version1126140 -Node: Extension GMP/MPFR Versioning1127871 -Node: Extension API Informational Variables1129499 -Node: Extension API Boilerplate1130572 -Node: Changes from API V11134546 -Node: Finding Extensions1136118 -Node: Extension Example1136677 -Node: Internal File Description1137475 -Node: Internal File Ops1141555 -Ref: Internal File Ops-Footnote-11152905 -Node: Using Internal File Ops1153045 -Ref: Using Internal File Ops-Footnote-11155428 -Node: Extension Samples1155702 -Node: Extension Sample File Functions1157231 -Node: Extension Sample Fnmatch1164880 -Node: Extension Sample Fork1166367 -Node: Extension Sample Inplace1167585 -Node: Extension Sample Ord1171211 -Node: Extension Sample Readdir1172047 -Ref: table-readdir-file-types1172936 -Node: Extension Sample Revout1174003 -Node: Extension Sample Rev2way1174592 -Node: Extension Sample Read write array1175332 -Node: Extension Sample Readfile1177274 -Node: Extension Sample Time1178369 -Node: Extension Sample API Tests1180121 -Node: gawkextlib1180613 -Node: Extension summary1183531 -Node: Extension Exercises1187233 -Node: Language History1188475 -Node: V7/SVR3.11190131 -Node: SVR41192283 -Node: POSIX1193717 -Node: BTL1195098 -Node: POSIX/GNU1195827 -Node: Feature History1201605 -Node: Common Extensions1218780 -Node: Ranges and Locales1220063 -Ref: Ranges and Locales-Footnote-11224679 -Ref: Ranges and Locales-Footnote-21224706 -Ref: Ranges and Locales-Footnote-31224941 -Node: Contributors1225164 -Node: History summary1231161 -Node: Installation1232541 -Node: Gawk Distribution1233485 -Node: Getting1233969 -Node: Extracting1234932 -Node: Distribution contents1236570 -Node: Unix Installation1243713 -Node: Quick Installation1244517 -Node: Compiling with MPFR1246993 -Node: Shell Startup Files1247683 -Node: Additional Configuration Options1248772 -Node: Configuration Philosophy1251087 -Node: Compiling from Git1253483 -Node: Building the Documentation1254038 -Node: Non-Unix Installation1255422 -Node: PC Installation1255882 -Node: PC Binary Installation1256720 -Node: PC Compiling1257155 -Node: PC Using1258272 -Node: Cygwin1261825 -Node: MSYS1263049 -Node: VMS Installation1263651 -Node: VMS Compilation1264370 -Ref: VMS Compilation-Footnote-11265599 -Node: VMS Dynamic Extensions1265657 -Node: VMS Installation Details1267342 -Node: VMS Running1269604 -Node: VMS GNV1273883 -Node: Bugs1274597 -Node: Bug definition1275509 -Node: Bug address1278445 -Node: Usenet1281833 -Node: Performance bugs1283022 -Node: Asking for help1285943 -Node: Maintainers1287910 -Node: Other Versions1289104 -Node: Installation summary1296956 -Node: Notes1298320 -Node: Compatibility Mode1299114 -Node: Additions1299896 -Node: Accessing The Source1300821 -Node: Adding Code1302258 -Node: New Ports1308477 -Node: Derived Files1312852 -Ref: Derived Files-Footnote-11318512 -Ref: Derived Files-Footnote-21318547 -Ref: Derived Files-Footnote-31319145 -Node: Future Extensions1319259 -Node: Implementation Limitations1319917 -Node: Extension Design1321127 -Node: Old Extension Problems1322271 -Ref: Old Extension Problems-Footnote-11323789 -Node: Extension New Mechanism Goals1323846 -Ref: Extension New Mechanism Goals-Footnote-11327210 -Node: Extension Other Design Decisions1327399 -Node: Extension Future Growth1329512 -Node: Notes summary1330118 -Node: Basic Concepts1331276 -Node: Basic High Level1331957 -Ref: figure-general-flow1332239 -Ref: figure-process-flow1332924 -Ref: Basic High Level-Footnote-11336225 -Node: Basic Data Typing1336410 -Node: Glossary1339738 -Node: Copying1371625 -Node: GNU Free Documentation License1409168 -Node: Index1434288 +Node: Foreword345584 +Node: Foreword450026 +Node: Preface51558 +Ref: Preface-Footnote-154417 +Ref: Preface-Footnote-254526 +Ref: Preface-Footnote-354760 +Node: History54902 +Node: Names57254 +Ref: Names-Footnote-158358 +Node: This Manual58505 +Ref: This Manual-Footnote-165144 +Node: Conventions65244 +Node: Manual History67613 +Ref: Manual History-Footnote-170610 +Ref: Manual History-Footnote-270651 +Node: How To Contribute70725 +Node: Acknowledgments71651 +Node: Getting Started76588 +Node: Running gawk79027 +Node: One-shot80217 +Node: Read Terminal81480 +Node: Long83473 +Node: Executable Scripts84986 +Ref: Executable Scripts-Footnote-187619 +Node: Comments87722 +Node: Quoting90206 +Node: DOS Quoting95732 +Node: Sample Data Files97788 +Node: Very Simple100383 +Node: Two Rules106485 +Node: More Complex108370 +Node: Statements/Lines110702 +Ref: Statements/Lines-Footnote-1115186 +Node: Other Features115451 +Node: When116387 +Ref: When-Footnote-1118141 +Node: Intro Summary118206 +Node: Invoking Gawk119090 +Node: Command Line120604 +Node: Options121402 +Ref: Options-Footnote-1139316 +Ref: Options-Footnote-2139547 +Node: Other Arguments139572 +Node: Naming Standard Input143583 +Node: Environment Variables144793 +Node: AWKPATH Variable145351 +Ref: AWKPATH Variable-Footnote-1148763 +Ref: AWKPATH Variable-Footnote-2148797 +Node: AWKLIBPATH Variable149168 +Ref: AWKLIBPATH Variable-Footnote-1150865 +Node: Other Environment Variables151240 +Node: Exit Status155192 +Node: Include Files155869 +Node: Loading Shared Libraries159559 +Node: Obsolete160987 +Node: Undocumented161679 +Node: Invoking Summary161976 +Node: Regexp164817 +Node: Regexp Usage166271 +Node: Escape Sequences168308 +Node: Regexp Operators174549 +Node: Regexp Operator Details175034 +Ref: Regexp Operator Details-Footnote-1182398 +Node: Interval Expressions182545 +Ref: Interval Expressions-Footnote-1184745 +Node: Bracket Expressions184843 +Ref: table-char-classes187319 +Node: Leftmost Longest190645 +Node: Computed Regexps191948 +Node: GNU Regexp Operators195375 +Node: Case-sensitivity199112 +Ref: Case-sensitivity-Footnote-1201978 +Ref: Case-sensitivity-Footnote-2202213 +Node: Regexp Summary202321 +Node: Reading Files203787 +Node: Records206056 +Node: awk split records207131 +Node: gawk split records211831 +Ref: gawk split records-Footnote-1216905 +Node: Fields216942 +Node: Nonconstant Fields219683 +Ref: Nonconstant Fields-Footnote-1221919 +Node: Changing Fields222123 +Node: Field Separators228154 +Node: Default Field Splitting230852 +Node: Regexp Field Splitting231970 +Node: Single Character Fields235647 +Node: Command Line Field Separator236707 +Node: Full Line Fields239925 +Ref: Full Line Fields-Footnote-1241447 +Ref: Full Line Fields-Footnote-2241493 +Node: Field Splitting Summary241594 +Node: Constant Size243668 +Node: Fixed width data244400 +Node: Skipping intervening247867 +Node: Allowing trailing data248665 +Node: Fields with fixed data249702 +Node: Splitting By Content251220 +Ref: Splitting By Content-Footnote-1255056 +Node: More CSV255219 +Node: FS versus FPAT256834 +Node: Testing field creation257994 +Node: Multiple Line259619 +Node: Getline265896 +Node: Plain Getline268365 +Node: Getline/Variable270938 +Node: Getline/File272089 +Node: Getline/Variable/File273477 +Ref: Getline/Variable/File-Footnote-1275082 +Node: Getline/Pipe275170 +Node: Getline/Variable/Pipe277874 +Node: Getline/Coprocess279009 +Node: Getline/Variable/Coprocess280276 +Node: Getline Notes281018 +Node: Getline Summary283815 +Ref: table-getline-variants284239 +Node: Read Timeout284987 +Ref: Read Timeout-Footnote-1288893 +Node: Retrying Input288951 +Node: Command-line directories290150 +Node: Input Summary291056 +Node: Input Exercises294228 +Node: Printing294662 +Node: Print296496 +Node: Print Examples297953 +Node: Output Separators300733 +Node: OFMT302750 +Node: Printf304106 +Node: Basic Printf304891 +Node: Control Letters306465 +Node: Format Modifiers311627 +Node: Printf Examples317642 +Node: Redirection320128 +Node: Special FD326969 +Ref: Special FD-Footnote-1330137 +Node: Special Files330211 +Node: Other Inherited Files330828 +Node: Special Network331829 +Node: Special Caveats332689 +Node: Close Files And Pipes333638 +Ref: table-close-pipe-return-values340545 +Ref: Close Files And Pipes-Footnote-1341358 +Ref: Close Files And Pipes-Footnote-2341506 +Node: Nonfatal341658 +Node: Output Summary343996 +Node: Output Exercises345218 +Node: Expressions345897 +Node: Values347085 +Node: Constants347763 +Node: Scalar Constants348454 +Ref: Scalar Constants-Footnote-1350964 +Node: Nondecimal-numbers351214 +Node: Regexp Constants354215 +Node: Using Constant Regexps354741 +Node: Standard Regexp Constants355363 +Node: Strong Regexp Constants358551 +Node: Variables362264 +Node: Using Variables362921 +Node: Assignment Options364831 +Node: Conversion367302 +Node: Strings And Numbers367826 +Ref: Strings And Numbers-Footnote-1370889 +Node: Locale influences conversions370998 +Ref: table-locale-affects373756 +Node: All Operators374374 +Node: Arithmetic Ops375003 +Node: Concatenation377719 +Ref: Concatenation-Footnote-1380566 +Node: Assignment Ops380673 +Ref: table-assign-ops385664 +Node: Increment Ops386977 +Node: Truth Values and Conditions390437 +Node: Truth Values391511 +Node: Typing and Comparison392559 +Node: Variable Typing393379 +Ref: Variable Typing-Footnote-1399842 +Ref: Variable Typing-Footnote-2399914 +Node: Comparison Operators399991 +Ref: table-relational-ops400410 +Node: POSIX String Comparison403905 +Ref: POSIX String Comparison-Footnote-1405600 +Ref: POSIX String Comparison-Footnote-2405739 +Node: Boolean Ops405823 +Ref: Boolean Ops-Footnote-1410305 +Node: Conditional Exp410397 +Node: Function Calls412133 +Node: Precedence416010 +Node: Locales419669 +Node: Expressions Summary421301 +Node: Patterns and Actions423874 +Node: Pattern Overview424994 +Node: Regexp Patterns426671 +Node: Expression Patterns427213 +Node: Ranges430994 +Node: BEGIN/END434102 +Node: Using BEGIN/END434863 +Ref: Using BEGIN/END-Footnote-1437617 +Node: I/O And BEGIN/END437723 +Node: BEGINFILE/ENDFILE440036 +Node: Empty443267 +Node: Using Shell Variables443584 +Node: Action Overview445858 +Node: Statements448183 +Node: If Statement450031 +Node: While Statement451526 +Node: Do Statement453554 +Node: For Statement454702 +Node: Switch Statement457957 +Node: Break Statement460398 +Node: Continue Statement462490 +Node: Next Statement464317 +Node: Nextfile Statement466700 +Node: Exit Statement469389 +Node: Built-in Variables471792 +Node: User-modified472925 +Node: Auto-set480692 +Ref: Auto-set-Footnote-1497499 +Ref: Auto-set-Footnote-2497705 +Node: ARGC and ARGV497761 +Node: Pattern Action Summary501974 +Node: Arrays504404 +Node: Array Basics505733 +Node: Array Intro506577 +Ref: figure-array-elements508552 +Ref: Array Intro-Footnote-1511256 +Node: Reference to Elements511384 +Node: Assigning Elements513848 +Node: Array Example514339 +Node: Scanning an Array516098 +Node: Controlling Scanning519120 +Ref: Controlling Scanning-Footnote-1525576 +Node: Numeric Array Subscripts525892 +Node: Uninitialized Subscripts528076 +Node: Delete529695 +Ref: Delete-Footnote-1532447 +Node: Multidimensional532504 +Node: Multiscanning535599 +Node: Arrays of Arrays537190 +Node: Arrays Summary541958 +Node: Functions544051 +Node: Built-in545089 +Node: Calling Built-in546242 +Node: Boolean Functions548238 +Node: Numeric Functions548792 +Ref: Numeric Functions-Footnote-1552819 +Ref: Numeric Functions-Footnote-2553467 +Ref: Numeric Functions-Footnote-3553515 +Node: String Functions553787 +Ref: String Functions-Footnote-1578629 +Ref: String Functions-Footnote-2578757 +Ref: String Functions-Footnote-3579005 +Node: Gory Details579092 +Ref: table-sub-escapes580883 +Ref: table-sub-proposed582402 +Ref: table-posix-sub583765 +Ref: table-gensub-escapes585306 +Ref: Gory Details-Footnote-1586129 +Node: I/O Functions586283 +Ref: table-system-return-values592737 +Ref: I/O Functions-Footnote-1594817 +Ref: I/O Functions-Footnote-2594965 +Node: Time Functions595085 +Ref: Time Functions-Footnote-1605756 +Ref: Time Functions-Footnote-2605824 +Ref: Time Functions-Footnote-3605982 +Ref: Time Functions-Footnote-4606093 +Ref: Time Functions-Footnote-5606205 +Ref: Time Functions-Footnote-6606432 +Node: Bitwise Functions606698 +Ref: table-bitwise-ops607292 +Ref: Bitwise Functions-Footnote-1613355 +Ref: Bitwise Functions-Footnote-2613528 +Node: Type Functions613719 +Node: I18N Functions617139 +Node: User-defined618790 +Node: Definition Syntax619602 +Ref: Definition Syntax-Footnote-1625296 +Node: Function Example625367 +Ref: Function Example-Footnote-1628289 +Node: Function Calling628311 +Node: Calling A Function628899 +Node: Variable Scope629857 +Node: Pass By Value/Reference632851 +Node: Function Caveats635495 +Ref: Function Caveats-Footnote-1637542 +Node: Return Statement637662 +Node: Dynamic Typing640641 +Node: Indirect Calls641571 +Ref: Indirect Calls-Footnote-1651826 +Node: Functions Summary651954 +Node: Library Functions654659 +Ref: Library Functions-Footnote-1658266 +Ref: Library Functions-Footnote-2658409 +Node: Library Names658580 +Ref: Library Names-Footnote-1662247 +Ref: Library Names-Footnote-2662470 +Node: General Functions662556 +Node: Strtonum Function663738 +Node: Assert Function666760 +Node: Round Function670086 +Node: Cliff Random Function671626 +Node: Ordinal Functions672642 +Ref: Ordinal Functions-Footnote-1675705 +Ref: Ordinal Functions-Footnote-2675957 +Node: Join Function676167 +Ref: Join Function-Footnote-1677937 +Node: Getlocaltime Function678137 +Node: Readfile Function681879 +Node: Shell Quoting683856 +Node: Isnumeric Function685284 +Node: Data File Management686672 +Node: Filetrans Function687304 +Node: Rewind Function691400 +Node: File Checking693309 +Ref: File Checking-Footnote-1694643 +Node: Empty Files694844 +Node: Ignoring Assigns696823 +Node: Getopt Function698373 +Ref: Getopt Function-Footnote-1713596 +Node: Passwd Functions713796 +Ref: Passwd Functions-Footnote-1722635 +Node: Group Functions722723 +Ref: Group Functions-Footnote-1730621 +Node: Walking Arrays730828 +Node: Library Functions Summary733836 +Node: Library Exercises735242 +Node: Sample Programs735707 +Node: Running Examples736477 +Node: Clones737205 +Node: Cut Program738429 +Node: Egrep Program748569 +Node: Id Program757570 +Node: Split Program767505 +Ref: Split Program-Footnote-1777398 +Node: Tee Program777571 +Node: Uniq Program780361 +Node: Wc Program787949 +Node: Bytes vs. Characters788336 +Node: Using extensions789884 +Node: wc program790638 +Node: Miscellaneous Programs795503 +Node: Dupword Program796716 +Node: Alarm Program798746 +Node: Translate Program803601 +Ref: Translate Program-Footnote-1808166 +Node: Labels Program808436 +Ref: Labels Program-Footnote-1811787 +Node: Word Sorting811871 +Node: History Sorting815943 +Node: Extract Program818168 +Node: Simple Sed826222 +Node: Igawk Program829296 +Ref: Igawk Program-Footnote-1843627 +Ref: Igawk Program-Footnote-2843829 +Ref: Igawk Program-Footnote-3843951 +Node: Anagram Program844066 +Node: Signature Program847128 +Node: Programs Summary848375 +Node: Programs Exercises849589 +Ref: Programs Exercises-Footnote-1853719 +Node: Advanced Features853805 +Node: Nondecimal Data855936 +Node: Boolean Typed Values857534 +Node: Array Sorting859415 +Node: Controlling Array Traversal860120 +Ref: Controlling Array Traversal-Footnote-1868488 +Node: Array Sorting Functions868606 +Ref: Array Sorting Functions-Footnote-1873980 +Node: Two-way I/O874176 +Ref: Two-way I/O-Footnote-1881902 +Ref: Two-way I/O-Footnote-2882089 +Node: TCP/IP Networking882171 +Node: Profiling885289 +Node: Extension Philosophy894598 +Node: Advanced Features Summary896077 +Node: Internationalization898092 +Node: I18N and L10N899766 +Node: Explaining gettext900453 +Ref: Explaining gettext-Footnote-1906345 +Ref: Explaining gettext-Footnote-2906530 +Node: Programmer i18n906695 +Ref: Programmer i18n-Footnote-1911644 +Node: Translator i18n911693 +Node: String Extraction912487 +Ref: String Extraction-Footnote-1913619 +Node: Printf Ordering913705 +Ref: Printf Ordering-Footnote-1916491 +Node: I18N Portability916555 +Ref: I18N Portability-Footnote-1919011 +Node: I18N Example919074 +Ref: I18N Example-Footnote-1922349 +Ref: I18N Example-Footnote-2922422 +Node: Gawk I18N922531 +Node: I18N Summary923180 +Node: Debugger924521 +Node: Debugging925521 +Node: Debugging Concepts925962 +Node: Debugging Terms927771 +Node: Awk Debugging930346 +Ref: Awk Debugging-Footnote-1931291 +Node: Sample Debugging Session931423 +Node: Debugger Invocation931957 +Node: Finding The Bug933343 +Node: List of Debugger Commands939817 +Node: Breakpoint Control941150 +Node: Debugger Execution Control944844 +Node: Viewing And Changing Data948206 +Node: Execution Stack951747 +Node: Debugger Info953384 +Node: Miscellaneous Debugger Commands957455 +Node: Readline Support962517 +Node: Limitations963413 +Node: Debugging Summary965967 +Node: Namespaces967246 +Node: Global Namespace968357 +Node: Qualified Names969755 +Node: Default Namespace970754 +Node: Changing The Namespace971495 +Node: Naming Rules973109 +Node: Internal Name Management974957 +Node: Namespace Example975999 +Node: Namespace And Features978561 +Node: Namespace Summary979996 +Node: Arbitrary Precision Arithmetic981473 +Node: Computer Arithmetic982960 +Ref: table-numeric-ranges986726 +Ref: table-floating-point-ranges987219 +Ref: Computer Arithmetic-Footnote-1987877 +Node: Math Definitions987934 +Ref: table-ieee-formats990910 +Node: MPFR features991477 +Node: FP Math Caution993195 +Ref: FP Math Caution-Footnote-1994267 +Node: Inexactness of computations994636 +Node: Inexact representation995667 +Node: Comparing FP Values997027 +Node: Errors accumulate998268 +Node: Strange values999724 +Ref: Strange values-Footnote-11002312 +Node: Getting Accuracy1002417 +Node: Try To Round1005127 +Node: Setting precision1006026 +Ref: table-predefined-precision-strings1006723 +Node: Setting the rounding mode1008553 +Ref: table-gawk-rounding-modes1008927 +Ref: Setting the rounding mode-Footnote-11012858 +Node: Arbitrary Precision Integers1013037 +Ref: Arbitrary Precision Integers-Footnote-11016212 +Node: Checking for MPFR1016361 +Node: POSIX Floating Point Problems1017835 +Ref: POSIX Floating Point Problems-Footnote-11022120 +Node: Floating point summary1022158 +Node: Dynamic Extensions1024348 +Node: Extension Intro1025901 +Node: Plugin License1027167 +Node: Extension Mechanism Outline1027964 +Ref: figure-load-extension1028403 +Ref: figure-register-new-function1029968 +Ref: figure-call-new-function1031060 +Node: Extension API Description1033122 +Node: Extension API Functions Introduction1034835 +Ref: table-api-std-headers1036671 +Node: General Data Types1040920 +Ref: General Data Types-Footnote-11049626 +Node: Memory Allocation Functions1049925 +Ref: Memory Allocation Functions-Footnote-11054426 +Node: Constructor Functions1054525 +Node: API Ownership of MPFR and GMP Values1058178 +Node: Registration Functions1059491 +Node: Extension Functions1060191 +Node: Exit Callback Functions1065513 +Node: Extension Version String1066763 +Node: Input Parsers1067426 +Node: Output Wrappers1080147 +Node: Two-way processors1084659 +Node: Printing Messages1086924 +Ref: Printing Messages-Footnote-11088095 +Node: Updating ERRNO1088248 +Node: Requesting Values1088987 +Ref: table-value-types-returned1089724 +Node: Accessing Parameters1090832 +Node: Symbol Table Access1092069 +Node: Symbol table by name1092581 +Ref: Symbol table by name-Footnote-11095606 +Node: Symbol table by cookie1095734 +Ref: Symbol table by cookie-Footnote-11099919 +Node: Cached values1099983 +Ref: Cached values-Footnote-11103519 +Node: Array Manipulation1103672 +Ref: Array Manipulation-Footnote-11104763 +Node: Array Data Types1104800 +Ref: Array Data Types-Footnote-11107458 +Node: Array Functions1107550 +Node: Flattening Arrays1112048 +Node: Creating Arrays1119024 +Node: Redirection API1123791 +Node: Extension API Variables1126624 +Node: Extension Versioning1127335 +Ref: gawk-api-version1127764 +Node: Extension GMP/MPFR Versioning1129495 +Node: Extension API Informational Variables1131123 +Node: Extension API Boilerplate1132196 +Node: Changes from API V11136170 +Node: Finding Extensions1137742 +Node: Extension Example1138301 +Node: Internal File Description1139099 +Node: Internal File Ops1143179 +Ref: Internal File Ops-Footnote-11154529 +Node: Using Internal File Ops1154669 +Ref: Using Internal File Ops-Footnote-11157052 +Node: Extension Samples1157326 +Node: Extension Sample File Functions1158855 +Node: Extension Sample Fnmatch1166504 +Node: Extension Sample Fork1167991 +Node: Extension Sample Inplace1169209 +Node: Extension Sample Ord1172835 +Node: Extension Sample Readdir1173671 +Ref: table-readdir-file-types1174560 +Node: Extension Sample Revout1175627 +Node: Extension Sample Rev2way1176216 +Node: Extension Sample Read write array1176956 +Node: Extension Sample Readfile1178898 +Node: Extension Sample Time1179993 +Node: Extension Sample API Tests1181745 +Node: gawkextlib1182237 +Node: Extension summary1185155 +Node: Extension Exercises1188857 +Node: Language History1190099 +Node: V7/SVR3.11191755 +Node: SVR41193907 +Node: POSIX1195341 +Node: BTL1196722 +Node: POSIX/GNU1197451 +Node: Feature History1203229 +Node: Common Extensions1220404 +Node: Ranges and Locales1221687 +Ref: Ranges and Locales-Footnote-11226303 +Ref: Ranges and Locales-Footnote-21226330 +Ref: Ranges and Locales-Footnote-31226565 +Node: Contributors1226788 +Node: History summary1232785 +Node: Installation1234165 +Node: Gawk Distribution1235109 +Node: Getting1235593 +Node: Extracting1236556 +Node: Distribution contents1238194 +Node: Unix Installation1245337 +Node: Quick Installation1246141 +Node: Compiling with MPFR1248617 +Node: Shell Startup Files1249307 +Node: Additional Configuration Options1250396 +Node: Configuration Philosophy1252711 +Node: Compiling from Git1255107 +Node: Building the Documentation1255662 +Node: Non-Unix Installation1257046 +Node: PC Installation1257506 +Node: PC Binary Installation1258344 +Node: PC Compiling1258779 +Node: PC Using1259896 +Node: Cygwin1263449 +Node: MSYS1264673 +Node: VMS Installation1265275 +Node: VMS Compilation1265994 +Ref: VMS Compilation-Footnote-11267223 +Node: VMS Dynamic Extensions1267281 +Node: VMS Installation Details1268966 +Node: VMS Running1271228 +Node: VMS GNV1275507 +Node: Bugs1276221 +Node: Bug definition1277133 +Node: Bug address1280069 +Node: Usenet1283457 +Node: Performance bugs1284646 +Node: Asking for help1287567 +Node: Maintainers1289534 +Node: Other Versions1290728 +Node: Installation summary1298580 +Node: Notes1299944 +Node: Compatibility Mode1300738 +Node: Additions1301520 +Node: Accessing The Source1302445 +Node: Adding Code1303882 +Node: New Ports1310101 +Node: Derived Files1314476 +Ref: Derived Files-Footnote-11320136 +Ref: Derived Files-Footnote-21320171 +Ref: Derived Files-Footnote-31320769 +Node: Future Extensions1320883 +Node: Implementation Limitations1321541 +Node: Extension Design1322751 +Node: Old Extension Problems1323895 +Ref: Old Extension Problems-Footnote-11325413 +Node: Extension New Mechanism Goals1325470 +Ref: Extension New Mechanism Goals-Footnote-11328834 +Node: Extension Other Design Decisions1329023 +Node: Extension Future Growth1331136 +Node: Notes summary1331742 +Node: Basic Concepts1332900 +Node: Basic High Level1333581 +Ref: figure-general-flow1333863 +Ref: figure-process-flow1334548 +Ref: Basic High Level-Footnote-11337849 +Node: Basic Data Typing1338034 +Node: Glossary1341362 +Node: Copying1373249 +Node: GNU Free Documentation License1410792 +Node: Index1435912 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 70832fc1..ef83bb35 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -579,6 +579,7 @@ particular records in a file and perform operations upon them. * Fields with fixed data:: Field values with fixed-width data. * Splitting By Content:: Defining Fields By Content * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. * Testing field creation:: Checking how @command{gawk} is splitting records. * Multiple Line:: Reading multiline records. @@ -8452,6 +8453,7 @@ four, and @code{$4} has the value @code{"ddd"}. @menu * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. @end menu @c O'Reilly doesn't like it as a note the first thing in the section. @@ -8661,6 +8663,28 @@ a bed with a blanket that's not quite big enough. There's always a corner that isn't covered. We recommend, instead, that you use Manuel Collado's @uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} library for @command{gawk}}. +@node FS versus FPAT +@subsection @code{FS} Versus @code{FPAT}: A Subtle Difference + +As we discussed earlier, @code{FS} describes the data between fields (``what fields are not'') +and @code{FPAT} describes the fields themselves (``what fields are''). +This leads to a subtle difference in how fields are found when using regexps as the value +for @code{FS} or @code{FPAT}. + +In order to distinguish one field from another, there must be a non-empty separator between +each field. This makes intuitive sense---otherwise one could not distinguish fields from +separators. + +Thus, regular expression matching as done when splitting fields with @code{FS} is not +allowed to match the null string; it must always match at least one character, in order +to be able to proceed through the entire record. + +On the other hand, regular expression matching with @code{FPAT} can match the null +string, and the non-matching intervening characters function as the separators. + +This same difference is reflected in how matching is done with the @code{split()} +and @code{patsplit()} functions (@pxref{String Functions}). + @node Testing field creation @section Checking How @command{gawk} Is Splitting Records @@ -19392,6 +19416,16 @@ Nonalphabetic characters are left unchanged. For example, @code{toupper("MiXeD cAsE 123")} returns @code{"MIXED CASE 123"}. @end table +At first glance, the @code{split()} and @code{patsplit()} functions appear to be +mirror images of each other. But there are differences: + +@itemize @bullet +@item @code{split()} treats its third argument like @code{FS}, with all the +special rules involved for @code{FS}. + +@item Matching of null strings differs. This is discussed in @ref{FS versus FPAT}. +@end itemize + @cindex sidebar @subentry Matching the Null String @ifdocbook @docbook diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 3b568e8a..4fd5975b 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -574,6 +574,7 @@ particular records in a file and perform operations upon them. * Fields with fixed data:: Field values with fixed-width data. * Splitting By Content:: Defining Fields By Content * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. * Testing field creation:: Checking how @command{gawk} is splitting records. * Multiple Line:: Reading multiline records. @@ -7921,6 +7922,7 @@ four, and @code{$4} has the value @code{"ddd"}. @menu * More CSV:: More on CSV files. +* FS versus FPAT:: A subtle difference. @end menu @c O'Reilly doesn't like it as a note the first thing in the section. @@ -8130,6 +8132,28 @@ a bed with a blanket that's not quite big enough. There's always a corner that isn't covered. We recommend, instead, that you use Manuel Collado's @uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} library for @command{gawk}}. +@node FS versus FPAT +@subsection @code{FS} Versus @code{FPAT}: A Subtle Difference + +As we discussed earlier, @code{FS} describes the data between fields (``what fields are not'') +and @code{FPAT} describes the fields themselves (``what fields are''). +This leads to a subtle difference in how fields are found when using regexps as the value +for @code{FS} or @code{FPAT}. + +In order to distinguish one field from another, there must be a non-empty separator between +each field. This makes intuitive sense---otherwise one could not distinguish fields from +separators. + +Thus, regular expression matching as done when splitting fields with @code{FS} is not +allowed to match the null string; it must always match at least one character, in order +to be able to proceed through the entire record. + +On the other hand, regular expression matching with @code{FPAT} can match the null +string, and the non-matching intervening characters function as the separators. + +This same difference is reflected in how matching is done with the @code{split()} +and @code{patsplit()} functions (@pxref{String Functions}). + @node Testing field creation @section Checking How @command{gawk} Is Splitting Records @@ -18533,6 +18557,16 @@ Nonalphabetic characters are left unchanged. For example, @code{toupper("MiXeD cAsE 123")} returns @code{"MIXED CASE 123"}. @end table +At first glance, the @code{split()} and @code{patsplit()} functions appear to be +mirror images of each other. But there are differences: + +@itemize @bullet +@item @code{split()} treats its third argument like @code{FS}, with all the +special rules involved for @code{FS}. + +@item Matching of null strings differs. This is discussed in @ref{FS versus FPAT}. +@end itemize + @sidebar Matching the Null String @cindex matching @subentry null strings @cindex null strings @subentry matching @@ -78,7 +78,7 @@ err(bool isfatal, const char *s, const char *emsg, va_list argp) } #ifdef HAVE_MPFR - if (FNR_node && is_mpg_number(FNR_node->var_value)) { + if (FNR_node && FNR_node->var_value && is_mpg_number(FNR_node->var_value)) { NODE *val; val = mpg_update_var(FNR_node); assert((val->flags & MPZN) != 0); diff --git a/pc/ChangeLog b/pc/ChangeLog index 62534fdf..8592deba 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,7 @@ +2021-10-20 Arnold D. Robbins <arnold@skeeve.com> + + * Makefile.tst: Regenerated. + 2021-10-13 Arnold D. Robbins <arnold@skeeve.com> * Makefile.tst: Regenerated. diff --git a/pc/Makefile.tst b/pc/Makefile.tst index c4b98e49..09a061d5 100644 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -3163,6 +3163,11 @@ profile9: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile16: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regexsub: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ |