diff options
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | doc/gawk.info | 1094 | ||||
-rw-r--r-- | doc/gawk.texi | 52 | ||||
-rw-r--r-- | doc/gawktexi.in | 22 |
4 files changed, 625 insertions, 549 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index 7326172d..416147dd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2021-01-08 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in (gawk split records): Document that RS = "()" + doesn't split records on the null string. + (Regexp Field Splitting): Ditto, for FS. + 2020-12-28 Juergen Kahrs <Juergen.Kahrs@googlemail.com> * gawkinet.texi: Update mailpopclient. diff --git a/doc/gawk.info b/doc/gawk.info index 84aaf435..1557359e 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -1,6 +1,6 @@ This is gawk.info, produced by makeinfo version 6.7 from gawk.texi. -Copyright (C) 1989, 1991, 1992, 1993, 1996-2005, 2007, 2009-2020 +Copyright (C) 1989, 1991, 1992, 1993, 1996-2005, 2007, 2009-2021 Free Software Foundation, Inc. @@ -37,7 +37,7 @@ General Introduction This file documents 'awk', a program that you can use to select particular records in a file and perform operations upon them. - Copyright (C) 1989, 1991, 1992, 1993, 1996-2005, 2007, 2009-2020 + Copyright (C) 1989, 1991, 1992, 1993, 1996-2005, 2007, 2009-2021 Free Software Foundation, Inc. @@ -4632,13 +4632,21 @@ that could match the trailing part is fairly long. 'gawk' attempts to avoid this problem, but currently, there's no guarantee that this will never happen. - NOTE: Remember that in 'awk', the '^' and '$' anchor metacharacters - match the beginning and end of a _string_, and not the beginning - and end of a _line_. As a result, something like 'RS = - "^[[:upper:]]"' can only match at the beginning of a file. This is - because 'gawk' views the input file as one long string that happens - to contain newline characters. It is thus best to avoid anchor - metacharacters in the value of 'RS'. + Caveats When Using Regular Expressions for 'RS' + + Remember that in 'awk', the '^' and '$' anchor metacharacters match +the beginning and end of a _string_, and not the beginning and end of a +_line_. As a result, something like 'RS = "^[[:upper:]]"' can only +match at the beginning of a file. This is because 'gawk' views the +input file as one long string that happens to contain newline +characters. It is thus best to avoid anchor metacharacters in the value +of 'RS'. + + Record splitting with regular expressions works differently than +regexp matching with the 'sub()', 'gsub()', and 'gensub()' (*note String +Functions::). Those functions allow a regexp to match the empty string; +record splitting does not. Thus, for example 'RS = "()"' does _not_ +split records between characters. The use of 'RS' as a regular expression and the 'RT' variable are 'gawk' extensions; they are not available in compatibility mode (*note @@ -5111,6 +5119,12 @@ beginning of the record. 'gawk' also works this way. For example: -| -->xxBxx<-- -| -->C<-- + Finally, field splitting with regular expressions works differently +than regexp matching with the 'sub()', 'gsub()', and 'gensub()' (*note +String Functions::). Those functions allow a regexp to match the empty +string; field splitting does not. Thus, for example 'FS = "()"' does +_not_ split fields between characters. + File: gawk.info, Node: Single Character Fields, Next: Command Line Field Separator, Prev: Regexp Field Splitting, Up: Field Separators @@ -35235,7 +35249,7 @@ Index * Brian Kernighan's awk <1>: Escape Sequences. (line 112) * Brian Kernighan's awk <2>: GNU Regexp Operators. (line 85) -* Brian Kernighan's awk <3>: gawk split records. (line 63) +* Brian Kernighan's awk <3>: gawk split records. (line 71) * Brian Kernighan's awk <4>: Regexp Field Splitting. (line 67) * Brian Kernighan's awk <5>: Getline/Pipe. (line 62) @@ -35502,7 +35516,7 @@ Index * dark corner, escape sequences, for metacharacters: Escape Sequences. (line 144) * dark corner, input files: awk split records. (line 104) -* dark corner, strings, storing: gawk split records. (line 86) +* dark corner, strings, storing: gawk split records. (line 94) * dark corner, NF variable, decrementing: Changing Fields. (line 107) * dark corner, ^, in FS: Regexp Field Splitting. (line 59) @@ -35730,9 +35744,9 @@ Index * differences in awk and gawk, RS/RT variables: awk split records. (line 118) * differences in awk and gawk, RS/RT variables <1>: gawk split records. - (line 58) + (line 66) * differences in awk and gawk, strings, storing: gawk split records. - (line 80) + (line 88) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, RS/RT variables <2>: Multiple Line. @@ -36279,7 +36293,7 @@ Index (line 26) * gawk, IGNORECASE variable in: Case-sensitivity. (line 26) * gawk, RT variable in: awk split records. (line 118) -* gawk, RT variable in <1>: gawk split records. (line 58) +* 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) @@ -37042,7 +37056,7 @@ Index * portability, backslash in escape sequences: Escape Sequences. (line 108) * portability, data files as single record: gawk split records. - (line 69) + (line 77) * portability, NF variable, decrementing: Changing Fields. (line 115) * portability, close() function and: Close Files And Pipes. (line 81) @@ -37287,7 +37301,7 @@ Index * records: Reading Files. (line 14) * records, splitting input into: Records. (line 6) * records, terminating: awk split records. (line 118) -* records, treating files as: gawk split records. (line 96) +* records, treating files as: gawk split records. (line 104) * records, multiline: Multiple Line. (line 6) * records, printing: Print. (line 22) * records <1>: Basic High Level. (line 62) @@ -37398,7 +37412,7 @@ Index * RSTART variable: Auto-set. (line 341) * RSTART variable, match() function and: String Functions. (line 234) * RT variable: awk split records. (line 118) -* RT variable <1>: gawk split records. (line 58) +* RT variable <1>: gawk split records. (line 66) * RT variable <2>: Multiple Line. (line 139) * RT variable <3>: Auto-set. (line 348) * Rubin, Paul: History. (line 30) @@ -37522,7 +37536,9 @@ Index (line 138) * sidebar, Using \n in Bracket Expressions of Dynamic Regexps: Computed Regexps. (line 58) -* sidebar, RS = "\0" Is Not Portable: gawk split records. (line 67) +* sidebar, Caveats When Using Regular Expressions for RS: gawk split records. + (line 50) +* sidebar, RS = "\0" Is Not Portable: gawk split records. (line 75) * sidebar, Understanding $0: Changing Fields. (line 135) * sidebar, Changing FS Does Not Affect the Fields: Full Line Fields. (line 14) @@ -37567,7 +37583,7 @@ Index * single quote ('), vs. apostrophe: Comments. (line 27) * single quote ('), in shell commands: Quoting. (line 48) * single quote ('), with double quotes: Quoting. (line 73) -* single records, treating files as: gawk split records. (line 96) +* single records, treating files as: gawk split records. (line 104) * single-character fields: Single Character Fields. (line 6) * single-precision: Computer Arithmetic. (line 61) @@ -37762,7 +37778,7 @@ Index * traceback, display in debugger: Execution Stack. (line 13) * translate string: I18N Functions. (line 21) * translate.awk program: Translate Program. (line 55) -* treating files, as single records: gawk split records. (line 96) +* treating files, as single records: gawk split records. (line 104) * troubleshooting, typographical errors, global variables: Options. (line 103) * troubleshooting, --non-decimal-data option: Options. (line 249) @@ -38064,525 +38080,525 @@ Node: Reading Files200920 Node: Records203189 Node: awk split records204264 Node: gawk split records208964 -Ref: gawk split records-Footnote-1213697 -Node: Fields213734 -Node: Nonconstant Fields216475 -Ref: Nonconstant Fields-Footnote-1218711 -Node: Changing Fields218915 -Node: Field Separators224946 -Node: Default Field Splitting227644 -Node: Regexp Field Splitting228762 -Node: Single Character Fields232115 -Node: Command Line Field Separator233175 -Node: Full Line Fields236393 -Ref: Full Line Fields-Footnote-1237915 -Ref: Full Line Fields-Footnote-2237961 -Node: Field Splitting Summary238062 -Node: Constant Size240136 -Node: Fixed width data240868 -Node: Skipping intervening244335 -Node: Allowing trailing data245133 -Node: Fields with fixed data246170 -Node: Splitting By Content247688 -Ref: Splitting By Content-Footnote-1251471 -Node: More CSV251634 -Node: Testing field creation253226 -Node: Multiple Line254851 -Node: Getline261128 -Node: Plain Getline263597 -Node: Getline/Variable266170 -Node: Getline/File267321 -Node: Getline/Variable/File268709 -Ref: Getline/Variable/File-Footnote-1270314 -Node: Getline/Pipe270402 -Node: Getline/Variable/Pipe273106 -Node: Getline/Coprocess274241 -Node: Getline/Variable/Coprocess275508 -Node: Getline Notes276250 -Node: Getline Summary279047 -Ref: table-getline-variants279471 -Node: Read Timeout280219 -Ref: Read Timeout-Footnote-1284125 -Node: Retrying Input284183 -Node: Command-line directories285382 -Node: Input Summary286288 -Node: Input Exercises289460 -Node: Printing289894 -Node: Print291728 -Node: Print Examples293185 -Node: Output Separators295965 -Node: OFMT297982 -Node: Printf299338 -Node: Basic Printf300123 -Node: Control Letters301697 -Node: Format Modifiers306861 -Node: Printf Examples312876 -Node: Redirection315362 -Node: Special FD322203 -Ref: Special FD-Footnote-1325371 -Node: Special Files325445 -Node: Other Inherited Files326062 -Node: Special Network327063 -Node: Special Caveats327923 -Node: Close Files And Pipes328872 -Ref: table-close-pipe-return-values335779 -Ref: Close Files And Pipes-Footnote-1336592 -Ref: Close Files And Pipes-Footnote-2336740 -Node: Nonfatal336892 -Node: Output Summary339230 -Node: Output Exercises340452 -Node: Expressions341131 -Node: Values342319 -Node: Constants342997 -Node: Scalar Constants343688 -Ref: Scalar Constants-Footnote-1346198 -Node: Nondecimal-numbers346448 -Node: Regexp Constants349449 -Node: Using Constant Regexps349975 -Node: Standard Regexp Constants350597 -Node: Strong Regexp Constants353785 -Node: Variables356797 -Node: Using Variables357454 -Node: Assignment Options359364 -Node: Conversion361835 -Node: Strings And Numbers362359 -Ref: Strings And Numbers-Footnote-1365422 -Node: Locale influences conversions365531 -Ref: table-locale-affects368289 -Node: All Operators368907 -Node: Arithmetic Ops369536 -Node: Concatenation372252 -Ref: Concatenation-Footnote-1375099 -Node: Assignment Ops375206 -Ref: table-assign-ops380197 -Node: Increment Ops381510 -Node: Truth Values and Conditions384970 -Node: Truth Values386044 -Node: Typing and Comparison387092 -Node: Variable Typing387912 -Ref: Variable Typing-Footnote-1394375 -Ref: Variable Typing-Footnote-2394447 -Node: Comparison Operators394524 -Ref: table-relational-ops394943 -Node: POSIX String Comparison398438 -Ref: POSIX String Comparison-Footnote-1400133 -Ref: POSIX String Comparison-Footnote-2400272 -Node: Boolean Ops400356 -Ref: Boolean Ops-Footnote-1404838 -Node: Conditional Exp404930 -Node: Function Calls406666 -Node: Precedence410543 -Node: Locales414202 -Node: Expressions Summary415834 -Node: Patterns and Actions418407 -Node: Pattern Overview419527 -Node: Regexp Patterns421204 -Node: Expression Patterns421746 -Node: Ranges425527 -Node: BEGIN/END428635 -Node: Using BEGIN/END429396 -Ref: Using BEGIN/END-Footnote-1432150 -Node: I/O And BEGIN/END432256 -Node: BEGINFILE/ENDFILE434569 -Node: Empty437800 -Node: Using Shell Variables438117 -Node: Action Overview440391 -Node: Statements442716 -Node: If Statement444564 -Node: While Statement446059 -Node: Do Statement448087 -Node: For Statement449235 -Node: Switch Statement452406 -Node: Break Statement454847 -Node: Continue Statement456939 -Node: Next Statement458766 -Node: Nextfile Statement461149 -Node: Exit Statement463838 -Node: Built-in Variables466241 -Node: User-modified467374 -Node: Auto-set475141 -Ref: Auto-set-Footnote-1491948 -Ref: Auto-set-Footnote-2492154 -Node: ARGC and ARGV492210 -Node: Pattern Action Summary496423 -Node: Arrays498853 -Node: Array Basics500182 -Node: Array Intro501026 -Ref: figure-array-elements503001 -Ref: Array Intro-Footnote-1505705 -Node: Reference to Elements505833 -Node: Assigning Elements508297 -Node: Array Example508788 -Node: Scanning an Array510547 -Node: Controlling Scanning513569 -Ref: Controlling Scanning-Footnote-1520025 -Node: Numeric Array Subscripts520341 -Node: Uninitialized Subscripts522525 -Node: Delete524144 -Ref: Delete-Footnote-1526896 -Node: Multidimensional526953 -Node: Multiscanning530048 -Node: Arrays of Arrays531639 -Node: Arrays Summary536407 -Node: Functions538500 -Node: Built-in539538 -Node: Calling Built-in540619 -Node: Numeric Functions542615 -Ref: Numeric Functions-Footnote-1546643 -Ref: Numeric Functions-Footnote-2547291 -Ref: Numeric Functions-Footnote-3547339 -Node: String Functions547611 -Ref: String Functions-Footnote-1571752 -Ref: String Functions-Footnote-2571880 -Ref: String Functions-Footnote-3572128 -Node: Gory Details572215 -Ref: table-sub-escapes574006 -Ref: table-sub-proposed575525 -Ref: table-posix-sub576888 -Ref: table-gensub-escapes578429 -Ref: Gory Details-Footnote-1579252 -Node: I/O Functions579406 -Ref: table-system-return-values585860 -Ref: I/O Functions-Footnote-1587940 -Ref: I/O Functions-Footnote-2588088 -Node: Time Functions588208 -Ref: Time Functions-Footnote-1598879 -Ref: Time Functions-Footnote-2598947 -Ref: Time Functions-Footnote-3599105 -Ref: Time Functions-Footnote-4599216 -Ref: Time Functions-Footnote-5599328 -Ref: Time Functions-Footnote-6599555 -Node: Bitwise Functions599821 -Ref: table-bitwise-ops600415 -Ref: Bitwise Functions-Footnote-1606478 -Ref: Bitwise Functions-Footnote-2606651 -Node: Type Functions606842 -Node: I18N Functions609705 -Node: User-defined611356 -Node: Definition Syntax612168 -Ref: Definition Syntax-Footnote-1617862 -Node: Function Example617933 -Ref: Function Example-Footnote-1620855 -Node: Function Calling620877 -Node: Calling A Function621465 -Node: Variable Scope622423 -Node: Pass By Value/Reference625417 -Node: Function Caveats628061 -Ref: Function Caveats-Footnote-1630108 -Node: Return Statement630228 -Node: Dynamic Typing633207 -Node: Indirect Calls634137 -Ref: Indirect Calls-Footnote-1644389 -Node: Functions Summary644517 -Node: Library Functions647222 -Ref: Library Functions-Footnote-1650829 -Ref: Library Functions-Footnote-2650972 -Node: Library Names651143 -Ref: Library Names-Footnote-1654810 -Ref: Library Names-Footnote-2655033 -Node: General Functions655119 -Node: Strtonum Function656222 -Node: Assert Function659244 -Node: Round Function662570 -Node: Cliff Random Function664110 -Node: Ordinal Functions665126 -Ref: Ordinal Functions-Footnote-1668189 -Ref: Ordinal Functions-Footnote-2668441 -Node: Join Function668651 -Ref: Join Function-Footnote-1670421 -Node: Getlocaltime Function670621 -Node: Readfile Function674363 -Node: Shell Quoting676340 -Node: Data File Management677741 -Node: Filetrans Function678373 -Node: Rewind Function682469 -Node: File Checking684378 -Ref: File Checking-Footnote-1685712 -Node: Empty Files685913 -Node: Ignoring Assigns687892 -Node: Getopt Function689442 -Ref: Getopt Function-Footnote-1704653 -Node: Passwd Functions704853 -Ref: Passwd Functions-Footnote-1713692 -Node: Group Functions713780 -Ref: Group Functions-Footnote-1721678 -Node: Walking Arrays721885 -Node: Library Functions Summary724893 -Node: Library Exercises726299 -Node: Sample Programs726764 -Node: Running Examples727534 -Node: Clones728262 -Node: Cut Program729486 -Node: Egrep Program739626 -Node: Id Program748637 -Node: Split Program758584 -Ref: Split Program-Footnote-1768474 -Node: Tee Program768647 -Node: Uniq Program771437 -Node: Wc Program779025 -Node: Bytes vs. Characters779422 -Node: Using extensions780970 -Node: wc program781724 -Node: Miscellaneous Programs786589 -Node: Dupword Program787802 -Node: Alarm Program789832 -Node: Translate Program794687 -Ref: Translate Program-Footnote-1799252 -Node: Labels Program799522 -Ref: Labels Program-Footnote-1802873 -Node: Word Sorting802957 -Node: History Sorting807029 -Node: Extract Program809254 -Node: Simple Sed817308 -Node: Igawk Program820382 -Ref: Igawk Program-Footnote-1834713 -Ref: Igawk Program-Footnote-2834915 -Ref: Igawk Program-Footnote-3835037 -Node: Anagram Program835152 -Node: Signature Program838214 -Node: Programs Summary839461 -Node: Programs Exercises840675 -Ref: Programs Exercises-Footnote-1844805 -Node: Advanced Features844891 -Node: Nondecimal Data846958 -Node: Array Sorting848549 -Node: Controlling Array Traversal849249 -Ref: Controlling Array Traversal-Footnote-1857617 -Node: Array Sorting Functions857735 -Ref: Array Sorting Functions-Footnote-1862826 -Node: Two-way I/O863022 -Ref: Two-way I/O-Footnote-1870743 -Ref: Two-way I/O-Footnote-2870930 -Node: TCP/IP Networking871012 -Node: Profiling874130 -Node: Extension Philosophy883439 -Node: Advanced Features Summary884890 -Node: Internationalization886889 -Node: I18N and L10N888369 -Node: Explaining gettext889056 -Ref: Explaining gettext-Footnote-1894948 -Ref: Explaining gettext-Footnote-2895133 -Node: Programmer i18n895298 -Ref: Programmer i18n-Footnote-1900247 -Node: Translator i18n900296 -Node: String Extraction901090 -Ref: String Extraction-Footnote-1902222 -Node: Printf Ordering902308 -Ref: Printf Ordering-Footnote-1905094 -Node: I18N Portability905158 -Ref: I18N Portability-Footnote-1907614 -Node: I18N Example907677 -Ref: I18N Example-Footnote-1910952 -Ref: I18N Example-Footnote-2911025 -Node: Gawk I18N911134 -Node: I18N Summary911783 -Node: Debugger913124 -Node: Debugging914124 -Node: Debugging Concepts914565 -Node: Debugging Terms916374 -Node: Awk Debugging918949 -Ref: Awk Debugging-Footnote-1919894 -Node: Sample Debugging Session920026 -Node: Debugger Invocation920560 -Node: Finding The Bug921946 -Node: List of Debugger Commands928420 -Node: Breakpoint Control929753 -Node: Debugger Execution Control933447 -Node: Viewing And Changing Data936809 -Node: Execution Stack940350 -Node: Debugger Info941987 -Node: Miscellaneous Debugger Commands946058 -Node: Readline Support951120 -Node: Limitations952016 -Node: Debugging Summary954570 -Node: Namespaces955849 -Node: Global Namespace956960 -Node: Qualified Names958358 -Node: Default Namespace959357 -Node: Changing The Namespace960098 -Node: Naming Rules961712 -Node: Internal Name Management963560 -Node: Namespace Example964602 -Node: Namespace And Features967164 -Node: Namespace Summary968599 -Node: Arbitrary Precision Arithmetic970076 -Node: Computer Arithmetic971563 -Ref: table-numeric-ranges975329 -Ref: table-floating-point-ranges975822 -Ref: Computer Arithmetic-Footnote-1976480 -Node: Math Definitions976537 -Ref: table-ieee-formats979853 -Ref: Math Definitions-Footnote-1980456 -Node: MPFR features980561 -Node: FP Math Caution982279 -Ref: FP Math Caution-Footnote-1983351 -Node: Inexactness of computations983720 -Node: Inexact representation984680 -Node: Comparing FP Values986040 -Node: Errors accumulate987281 -Node: Getting Accuracy988714 -Node: Try To Round991424 -Node: Setting precision992323 -Ref: table-predefined-precision-strings993020 -Node: Setting the rounding mode994850 -Ref: table-gawk-rounding-modes995224 -Ref: Setting the rounding mode-Footnote-1999155 -Node: Arbitrary Precision Integers999334 -Ref: Arbitrary Precision Integers-Footnote-11002509 -Node: Checking for MPFR1002658 -Node: POSIX Floating Point Problems1004132 -Ref: POSIX Floating Point Problems-Footnote-11008417 -Node: Floating point summary1008455 -Node: Dynamic Extensions1010645 -Node: Extension Intro1012198 -Node: Plugin License1013464 -Node: Extension Mechanism Outline1014261 -Ref: figure-load-extension1014700 -Ref: figure-register-new-function1016265 -Ref: figure-call-new-function1017357 -Node: Extension API Description1019419 -Node: Extension API Functions Introduction1021132 -Ref: table-api-std-headers1022968 -Node: General Data Types1027217 -Ref: General Data Types-Footnote-11035847 -Node: Memory Allocation Functions1036146 -Ref: Memory Allocation Functions-Footnote-11040647 -Node: Constructor Functions1040746 -Node: API Ownership of MPFR and GMP Values1044212 -Node: Registration Functions1045525 -Node: Extension Functions1046225 -Node: Exit Callback Functions1051547 -Node: Extension Version String1052797 -Node: Input Parsers1053460 -Node: Output Wrappers1066181 -Node: Two-way processors1070693 -Node: Printing Messages1072958 -Ref: Printing Messages-Footnote-11074129 -Node: Updating ERRNO1074282 -Node: Requesting Values1075021 -Ref: table-value-types-returned1075758 -Node: Accessing Parameters1076694 -Node: Symbol Table Access1077931 -Node: Symbol table by name1078443 -Ref: Symbol table by name-Footnote-11081467 -Node: Symbol table by cookie1081595 -Ref: Symbol table by cookie-Footnote-11085780 -Node: Cached values1085844 -Ref: Cached values-Footnote-11089380 -Node: Array Manipulation1089533 -Ref: Array Manipulation-Footnote-11090624 -Node: Array Data Types1090661 -Ref: Array Data Types-Footnote-11093319 -Node: Array Functions1093411 -Node: Flattening Arrays1097909 -Node: Creating Arrays1104885 -Node: Redirection API1109652 -Node: Extension API Variables1112485 -Node: Extension Versioning1113196 -Ref: gawk-api-version1113625 -Node: Extension GMP/MPFR Versioning1115356 -Node: Extension API Informational Variables1116984 -Node: Extension API Boilerplate1118057 -Node: Changes from API V11122031 -Node: Finding Extensions1123603 -Node: Extension Example1124162 -Node: Internal File Description1124960 -Node: Internal File Ops1129040 -Ref: Internal File Ops-Footnote-11140390 -Node: Using Internal File Ops1140530 -Ref: Using Internal File Ops-Footnote-11142913 -Node: Extension Samples1143187 -Node: Extension Sample File Functions1144716 -Node: Extension Sample Fnmatch1152365 -Node: Extension Sample Fork1153852 -Node: Extension Sample Inplace1155070 -Node: Extension Sample Ord1158696 -Node: Extension Sample Readdir1159532 -Ref: table-readdir-file-types1160421 -Node: Extension Sample Revout1161488 -Node: Extension Sample Rev2way1162077 -Node: Extension Sample Read write array1162817 -Node: Extension Sample Readfile1164759 -Node: Extension Sample Time1165854 -Node: Extension Sample API Tests1167606 -Node: gawkextlib1168098 -Node: Extension summary1171016 -Node: Extension Exercises1174718 -Node: Language History1175960 -Node: V7/SVR3.11177616 -Node: SVR41179768 -Node: POSIX1181202 -Node: BTL1182583 -Node: POSIX/GNU1183312 -Node: Feature History1189090 -Node: Common Extensions1205409 -Node: Ranges and Locales1206692 -Ref: Ranges and Locales-Footnote-11211308 -Ref: Ranges and Locales-Footnote-21211335 -Ref: Ranges and Locales-Footnote-31211570 -Node: Contributors1211793 -Node: History summary1217790 -Node: Installation1219170 -Node: Gawk Distribution1220114 -Node: Getting1220598 -Node: Extracting1221561 -Node: Distribution contents1223199 -Node: Unix Installation1229679 -Node: Quick Installation1230361 -Node: Shell Startup Files1232775 -Node: Additional Configuration Options1233864 -Node: Configuration Philosophy1236179 -Node: Non-Unix Installation1238548 -Node: PC Installation1239008 -Node: PC Binary Installation1239846 -Node: PC Compiling1240281 -Node: PC Using1241398 -Node: Cygwin1244951 -Node: MSYS1246175 -Node: VMS Installation1246777 -Node: VMS Compilation1247568 -Ref: VMS Compilation-Footnote-11248797 -Node: VMS Dynamic Extensions1248855 -Node: VMS Installation Details1250540 -Node: VMS Running1252793 -Node: VMS GNV1257072 -Node: VMS Old Gawk1257807 -Node: Bugs1258278 -Node: Bug address1258941 -Node: Usenet1261923 -Node: Maintainers1262927 -Node: Other Versions1264112 -Node: Installation summary1271200 -Node: Notes1272409 -Node: Compatibility Mode1273203 -Node: Additions1273985 -Node: Accessing The Source1274910 -Node: Adding Code1276347 -Node: New Ports1282566 -Node: Derived Files1286941 -Ref: Derived Files-Footnote-11292601 -Ref: Derived Files-Footnote-21292636 -Ref: Derived Files-Footnote-31293234 -Node: Future Extensions1293348 -Node: Implementation Limitations1294006 -Node: Extension Design1295216 -Node: Old Extension Problems1296360 -Ref: Old Extension Problems-Footnote-11297878 -Node: Extension New Mechanism Goals1297935 -Ref: Extension New Mechanism Goals-Footnote-11301299 -Node: Extension Other Design Decisions1301488 -Node: Extension Future Growth1303601 -Node: Notes summary1304207 -Node: Basic Concepts1305365 -Node: Basic High Level1306046 -Ref: figure-general-flow1306328 -Ref: figure-process-flow1307013 -Ref: Basic High Level-Footnote-11310314 -Node: Basic Data Typing1310499 -Node: Glossary1313827 -Node: Copying1345712 -Node: GNU Free Documentation License1383255 -Node: Index1408375 +Ref: gawk split records-Footnote-1214038 +Node: Fields214075 +Node: Nonconstant Fields216816 +Ref: Nonconstant Fields-Footnote-1219052 +Node: Changing Fields219256 +Node: Field Separators225287 +Node: Default Field Splitting227985 +Node: Regexp Field Splitting229103 +Node: Single Character Fields232780 +Node: Command Line Field Separator233840 +Node: Full Line Fields237058 +Ref: Full Line Fields-Footnote-1238580 +Ref: Full Line Fields-Footnote-2238626 +Node: Field Splitting Summary238727 +Node: Constant Size240801 +Node: Fixed width data241533 +Node: Skipping intervening245000 +Node: Allowing trailing data245798 +Node: Fields with fixed data246835 +Node: Splitting By Content248353 +Ref: Splitting By Content-Footnote-1252136 +Node: More CSV252299 +Node: Testing field creation253891 +Node: Multiple Line255516 +Node: Getline261793 +Node: Plain Getline264262 +Node: Getline/Variable266835 +Node: Getline/File267986 +Node: Getline/Variable/File269374 +Ref: Getline/Variable/File-Footnote-1270979 +Node: Getline/Pipe271067 +Node: Getline/Variable/Pipe273771 +Node: Getline/Coprocess274906 +Node: Getline/Variable/Coprocess276173 +Node: Getline Notes276915 +Node: Getline Summary279712 +Ref: table-getline-variants280136 +Node: Read Timeout280884 +Ref: Read Timeout-Footnote-1284790 +Node: Retrying Input284848 +Node: Command-line directories286047 +Node: Input Summary286953 +Node: Input Exercises290125 +Node: Printing290559 +Node: Print292393 +Node: Print Examples293850 +Node: Output Separators296630 +Node: OFMT298647 +Node: Printf300003 +Node: Basic Printf300788 +Node: Control Letters302362 +Node: Format Modifiers307526 +Node: Printf Examples313541 +Node: Redirection316027 +Node: Special FD322868 +Ref: Special FD-Footnote-1326036 +Node: Special Files326110 +Node: Other Inherited Files326727 +Node: Special Network327728 +Node: Special Caveats328588 +Node: Close Files And Pipes329537 +Ref: table-close-pipe-return-values336444 +Ref: Close Files And Pipes-Footnote-1337257 +Ref: Close Files And Pipes-Footnote-2337405 +Node: Nonfatal337557 +Node: Output Summary339895 +Node: Output Exercises341117 +Node: Expressions341796 +Node: Values342984 +Node: Constants343662 +Node: Scalar Constants344353 +Ref: Scalar Constants-Footnote-1346863 +Node: Nondecimal-numbers347113 +Node: Regexp Constants350114 +Node: Using Constant Regexps350640 +Node: Standard Regexp Constants351262 +Node: Strong Regexp Constants354450 +Node: Variables357462 +Node: Using Variables358119 +Node: Assignment Options360029 +Node: Conversion362500 +Node: Strings And Numbers363024 +Ref: Strings And Numbers-Footnote-1366087 +Node: Locale influences conversions366196 +Ref: table-locale-affects368954 +Node: All Operators369572 +Node: Arithmetic Ops370201 +Node: Concatenation372917 +Ref: Concatenation-Footnote-1375764 +Node: Assignment Ops375871 +Ref: table-assign-ops380862 +Node: Increment Ops382175 +Node: Truth Values and Conditions385635 +Node: Truth Values386709 +Node: Typing and Comparison387757 +Node: Variable Typing388577 +Ref: Variable Typing-Footnote-1395040 +Ref: Variable Typing-Footnote-2395112 +Node: Comparison Operators395189 +Ref: table-relational-ops395608 +Node: POSIX String Comparison399103 +Ref: POSIX String Comparison-Footnote-1400798 +Ref: POSIX String Comparison-Footnote-2400937 +Node: Boolean Ops401021 +Ref: Boolean Ops-Footnote-1405503 +Node: Conditional Exp405595 +Node: Function Calls407331 +Node: Precedence411208 +Node: Locales414867 +Node: Expressions Summary416499 +Node: Patterns and Actions419072 +Node: Pattern Overview420192 +Node: Regexp Patterns421869 +Node: Expression Patterns422411 +Node: Ranges426192 +Node: BEGIN/END429300 +Node: Using BEGIN/END430061 +Ref: Using BEGIN/END-Footnote-1432815 +Node: I/O And BEGIN/END432921 +Node: BEGINFILE/ENDFILE435234 +Node: Empty438465 +Node: Using Shell Variables438782 +Node: Action Overview441056 +Node: Statements443381 +Node: If Statement445229 +Node: While Statement446724 +Node: Do Statement448752 +Node: For Statement449900 +Node: Switch Statement453071 +Node: Break Statement455512 +Node: Continue Statement457604 +Node: Next Statement459431 +Node: Nextfile Statement461814 +Node: Exit Statement464503 +Node: Built-in Variables466906 +Node: User-modified468039 +Node: Auto-set475806 +Ref: Auto-set-Footnote-1492613 +Ref: Auto-set-Footnote-2492819 +Node: ARGC and ARGV492875 +Node: Pattern Action Summary497088 +Node: Arrays499518 +Node: Array Basics500847 +Node: Array Intro501691 +Ref: figure-array-elements503666 +Ref: Array Intro-Footnote-1506370 +Node: Reference to Elements506498 +Node: Assigning Elements508962 +Node: Array Example509453 +Node: Scanning an Array511212 +Node: Controlling Scanning514234 +Ref: Controlling Scanning-Footnote-1520690 +Node: Numeric Array Subscripts521006 +Node: Uninitialized Subscripts523190 +Node: Delete524809 +Ref: Delete-Footnote-1527561 +Node: Multidimensional527618 +Node: Multiscanning530713 +Node: Arrays of Arrays532304 +Node: Arrays Summary537072 +Node: Functions539165 +Node: Built-in540203 +Node: Calling Built-in541284 +Node: Numeric Functions543280 +Ref: Numeric Functions-Footnote-1547308 +Ref: Numeric Functions-Footnote-2547956 +Ref: Numeric Functions-Footnote-3548004 +Node: String Functions548276 +Ref: String Functions-Footnote-1572417 +Ref: String Functions-Footnote-2572545 +Ref: String Functions-Footnote-3572793 +Node: Gory Details572880 +Ref: table-sub-escapes574671 +Ref: table-sub-proposed576190 +Ref: table-posix-sub577553 +Ref: table-gensub-escapes579094 +Ref: Gory Details-Footnote-1579917 +Node: I/O Functions580071 +Ref: table-system-return-values586525 +Ref: I/O Functions-Footnote-1588605 +Ref: I/O Functions-Footnote-2588753 +Node: Time Functions588873 +Ref: Time Functions-Footnote-1599544 +Ref: Time Functions-Footnote-2599612 +Ref: Time Functions-Footnote-3599770 +Ref: Time Functions-Footnote-4599881 +Ref: Time Functions-Footnote-5599993 +Ref: Time Functions-Footnote-6600220 +Node: Bitwise Functions600486 +Ref: table-bitwise-ops601080 +Ref: Bitwise Functions-Footnote-1607143 +Ref: Bitwise Functions-Footnote-2607316 +Node: Type Functions607507 +Node: I18N Functions610370 +Node: User-defined612021 +Node: Definition Syntax612833 +Ref: Definition Syntax-Footnote-1618527 +Node: Function Example618598 +Ref: Function Example-Footnote-1621520 +Node: Function Calling621542 +Node: Calling A Function622130 +Node: Variable Scope623088 +Node: Pass By Value/Reference626082 +Node: Function Caveats628726 +Ref: Function Caveats-Footnote-1630773 +Node: Return Statement630893 +Node: Dynamic Typing633872 +Node: Indirect Calls634802 +Ref: Indirect Calls-Footnote-1645054 +Node: Functions Summary645182 +Node: Library Functions647887 +Ref: Library Functions-Footnote-1651494 +Ref: Library Functions-Footnote-2651637 +Node: Library Names651808 +Ref: Library Names-Footnote-1655475 +Ref: Library Names-Footnote-2655698 +Node: General Functions655784 +Node: Strtonum Function656887 +Node: Assert Function659909 +Node: Round Function663235 +Node: Cliff Random Function664775 +Node: Ordinal Functions665791 +Ref: Ordinal Functions-Footnote-1668854 +Ref: Ordinal Functions-Footnote-2669106 +Node: Join Function669316 +Ref: Join Function-Footnote-1671086 +Node: Getlocaltime Function671286 +Node: Readfile Function675028 +Node: Shell Quoting677005 +Node: Data File Management678406 +Node: Filetrans Function679038 +Node: Rewind Function683134 +Node: File Checking685043 +Ref: File Checking-Footnote-1686377 +Node: Empty Files686578 +Node: Ignoring Assigns688557 +Node: Getopt Function690107 +Ref: Getopt Function-Footnote-1705318 +Node: Passwd Functions705518 +Ref: Passwd Functions-Footnote-1714357 +Node: Group Functions714445 +Ref: Group Functions-Footnote-1722343 +Node: Walking Arrays722550 +Node: Library Functions Summary725558 +Node: Library Exercises726964 +Node: Sample Programs727429 +Node: Running Examples728199 +Node: Clones728927 +Node: Cut Program730151 +Node: Egrep Program740291 +Node: Id Program749302 +Node: Split Program759249 +Ref: Split Program-Footnote-1769139 +Node: Tee Program769312 +Node: Uniq Program772102 +Node: Wc Program779690 +Node: Bytes vs. Characters780087 +Node: Using extensions781635 +Node: wc program782389 +Node: Miscellaneous Programs787254 +Node: Dupword Program788467 +Node: Alarm Program790497 +Node: Translate Program795352 +Ref: Translate Program-Footnote-1799917 +Node: Labels Program800187 +Ref: Labels Program-Footnote-1803538 +Node: Word Sorting803622 +Node: History Sorting807694 +Node: Extract Program809919 +Node: Simple Sed817973 +Node: Igawk Program821047 +Ref: Igawk Program-Footnote-1835378 +Ref: Igawk Program-Footnote-2835580 +Ref: Igawk Program-Footnote-3835702 +Node: Anagram Program835817 +Node: Signature Program838879 +Node: Programs Summary840126 +Node: Programs Exercises841340 +Ref: Programs Exercises-Footnote-1845470 +Node: Advanced Features845556 +Node: Nondecimal Data847623 +Node: Array Sorting849214 +Node: Controlling Array Traversal849914 +Ref: Controlling Array Traversal-Footnote-1858282 +Node: Array Sorting Functions858400 +Ref: Array Sorting Functions-Footnote-1863491 +Node: Two-way I/O863687 +Ref: Two-way I/O-Footnote-1871408 +Ref: Two-way I/O-Footnote-2871595 +Node: TCP/IP Networking871677 +Node: Profiling874795 +Node: Extension Philosophy884104 +Node: Advanced Features Summary885555 +Node: Internationalization887554 +Node: I18N and L10N889034 +Node: Explaining gettext889721 +Ref: Explaining gettext-Footnote-1895613 +Ref: Explaining gettext-Footnote-2895798 +Node: Programmer i18n895963 +Ref: Programmer i18n-Footnote-1900912 +Node: Translator i18n900961 +Node: String Extraction901755 +Ref: String Extraction-Footnote-1902887 +Node: Printf Ordering902973 +Ref: Printf Ordering-Footnote-1905759 +Node: I18N Portability905823 +Ref: I18N Portability-Footnote-1908279 +Node: I18N Example908342 +Ref: I18N Example-Footnote-1911617 +Ref: I18N Example-Footnote-2911690 +Node: Gawk I18N911799 +Node: I18N Summary912448 +Node: Debugger913789 +Node: Debugging914789 +Node: Debugging Concepts915230 +Node: Debugging Terms917039 +Node: Awk Debugging919614 +Ref: Awk Debugging-Footnote-1920559 +Node: Sample Debugging Session920691 +Node: Debugger Invocation921225 +Node: Finding The Bug922611 +Node: List of Debugger Commands929085 +Node: Breakpoint Control930418 +Node: Debugger Execution Control934112 +Node: Viewing And Changing Data937474 +Node: Execution Stack941015 +Node: Debugger Info942652 +Node: Miscellaneous Debugger Commands946723 +Node: Readline Support951785 +Node: Limitations952681 +Node: Debugging Summary955235 +Node: Namespaces956514 +Node: Global Namespace957625 +Node: Qualified Names959023 +Node: Default Namespace960022 +Node: Changing The Namespace960763 +Node: Naming Rules962377 +Node: Internal Name Management964225 +Node: Namespace Example965267 +Node: Namespace And Features967829 +Node: Namespace Summary969264 +Node: Arbitrary Precision Arithmetic970741 +Node: Computer Arithmetic972228 +Ref: table-numeric-ranges975994 +Ref: table-floating-point-ranges976487 +Ref: Computer Arithmetic-Footnote-1977145 +Node: Math Definitions977202 +Ref: table-ieee-formats980518 +Ref: Math Definitions-Footnote-1981121 +Node: MPFR features981226 +Node: FP Math Caution982944 +Ref: FP Math Caution-Footnote-1984016 +Node: Inexactness of computations984385 +Node: Inexact representation985345 +Node: Comparing FP Values986705 +Node: Errors accumulate987946 +Node: Getting Accuracy989379 +Node: Try To Round992089 +Node: Setting precision992988 +Ref: table-predefined-precision-strings993685 +Node: Setting the rounding mode995515 +Ref: table-gawk-rounding-modes995889 +Ref: Setting the rounding mode-Footnote-1999820 +Node: Arbitrary Precision Integers999999 +Ref: Arbitrary Precision Integers-Footnote-11003174 +Node: Checking for MPFR1003323 +Node: POSIX Floating Point Problems1004797 +Ref: POSIX Floating Point Problems-Footnote-11009082 +Node: Floating point summary1009120 +Node: Dynamic Extensions1011310 +Node: Extension Intro1012863 +Node: Plugin License1014129 +Node: Extension Mechanism Outline1014926 +Ref: figure-load-extension1015365 +Ref: figure-register-new-function1016930 +Ref: figure-call-new-function1018022 +Node: Extension API Description1020084 +Node: Extension API Functions Introduction1021797 +Ref: table-api-std-headers1023633 +Node: General Data Types1027882 +Ref: General Data Types-Footnote-11036512 +Node: Memory Allocation Functions1036811 +Ref: Memory Allocation Functions-Footnote-11041312 +Node: Constructor Functions1041411 +Node: API Ownership of MPFR and GMP Values1044877 +Node: Registration Functions1046190 +Node: Extension Functions1046890 +Node: Exit Callback Functions1052212 +Node: Extension Version String1053462 +Node: Input Parsers1054125 +Node: Output Wrappers1066846 +Node: Two-way processors1071358 +Node: Printing Messages1073623 +Ref: Printing Messages-Footnote-11074794 +Node: Updating ERRNO1074947 +Node: Requesting Values1075686 +Ref: table-value-types-returned1076423 +Node: Accessing Parameters1077359 +Node: Symbol Table Access1078596 +Node: Symbol table by name1079108 +Ref: Symbol table by name-Footnote-11082132 +Node: Symbol table by cookie1082260 +Ref: Symbol table by cookie-Footnote-11086445 +Node: Cached values1086509 +Ref: Cached values-Footnote-11090045 +Node: Array Manipulation1090198 +Ref: Array Manipulation-Footnote-11091289 +Node: Array Data Types1091326 +Ref: Array Data Types-Footnote-11093984 +Node: Array Functions1094076 +Node: Flattening Arrays1098574 +Node: Creating Arrays1105550 +Node: Redirection API1110317 +Node: Extension API Variables1113150 +Node: Extension Versioning1113861 +Ref: gawk-api-version1114290 +Node: Extension GMP/MPFR Versioning1116021 +Node: Extension API Informational Variables1117649 +Node: Extension API Boilerplate1118722 +Node: Changes from API V11122696 +Node: Finding Extensions1124268 +Node: Extension Example1124827 +Node: Internal File Description1125625 +Node: Internal File Ops1129705 +Ref: Internal File Ops-Footnote-11141055 +Node: Using Internal File Ops1141195 +Ref: Using Internal File Ops-Footnote-11143578 +Node: Extension Samples1143852 +Node: Extension Sample File Functions1145381 +Node: Extension Sample Fnmatch1153030 +Node: Extension Sample Fork1154517 +Node: Extension Sample Inplace1155735 +Node: Extension Sample Ord1159361 +Node: Extension Sample Readdir1160197 +Ref: table-readdir-file-types1161086 +Node: Extension Sample Revout1162153 +Node: Extension Sample Rev2way1162742 +Node: Extension Sample Read write array1163482 +Node: Extension Sample Readfile1165424 +Node: Extension Sample Time1166519 +Node: Extension Sample API Tests1168271 +Node: gawkextlib1168763 +Node: Extension summary1171681 +Node: Extension Exercises1175383 +Node: Language History1176625 +Node: V7/SVR3.11178281 +Node: SVR41180433 +Node: POSIX1181867 +Node: BTL1183248 +Node: POSIX/GNU1183977 +Node: Feature History1189755 +Node: Common Extensions1206074 +Node: Ranges and Locales1207357 +Ref: Ranges and Locales-Footnote-11211973 +Ref: Ranges and Locales-Footnote-21212000 +Ref: Ranges and Locales-Footnote-31212235 +Node: Contributors1212458 +Node: History summary1218455 +Node: Installation1219835 +Node: Gawk Distribution1220779 +Node: Getting1221263 +Node: Extracting1222226 +Node: Distribution contents1223864 +Node: Unix Installation1230344 +Node: Quick Installation1231026 +Node: Shell Startup Files1233440 +Node: Additional Configuration Options1234529 +Node: Configuration Philosophy1236844 +Node: Non-Unix Installation1239213 +Node: PC Installation1239673 +Node: PC Binary Installation1240511 +Node: PC Compiling1240946 +Node: PC Using1242063 +Node: Cygwin1245616 +Node: MSYS1246840 +Node: VMS Installation1247442 +Node: VMS Compilation1248233 +Ref: VMS Compilation-Footnote-11249462 +Node: VMS Dynamic Extensions1249520 +Node: VMS Installation Details1251205 +Node: VMS Running1253458 +Node: VMS GNV1257737 +Node: VMS Old Gawk1258472 +Node: Bugs1258943 +Node: Bug address1259606 +Node: Usenet1262588 +Node: Maintainers1263592 +Node: Other Versions1264777 +Node: Installation summary1271865 +Node: Notes1273074 +Node: Compatibility Mode1273868 +Node: Additions1274650 +Node: Accessing The Source1275575 +Node: Adding Code1277012 +Node: New Ports1283231 +Node: Derived Files1287606 +Ref: Derived Files-Footnote-11293266 +Ref: Derived Files-Footnote-21293301 +Ref: Derived Files-Footnote-31293899 +Node: Future Extensions1294013 +Node: Implementation Limitations1294671 +Node: Extension Design1295881 +Node: Old Extension Problems1297025 +Ref: Old Extension Problems-Footnote-11298543 +Node: Extension New Mechanism Goals1298600 +Ref: Extension New Mechanism Goals-Footnote-11301964 +Node: Extension Other Design Decisions1302153 +Node: Extension Future Growth1304266 +Node: Notes summary1304872 +Node: Basic Concepts1306030 +Node: Basic High Level1306711 +Ref: figure-general-flow1306993 +Ref: figure-process-flow1307678 +Ref: Basic High Level-Footnote-11310979 +Node: Basic Data Typing1311164 +Node: Glossary1314492 +Node: Copying1346377 +Node: GNU Free Documentation License1383920 +Node: Index1409040 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index e4d02059..414d5d8c 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -59,7 +59,7 @@ @c applies to and all the info about who's publishing this edition @c These apply across the board. -@set UPDATE-MONTH September, 2020 +@set UPDATE-MONTH January, 2021 @set VERSION 5.1 @set PATCHLEVEL 0 @@ -285,13 +285,13 @@ Fax: +1-617-542-2652 Email: <email>gnu@@gnu.org</email> URL: <ulink url="https://www.gnu.org">https://www.gnu.org/</ulink></literallayout> -<literallayout class="normal">Copyright © 1989, 1991, 1992, 1993, 1996–2005, 2007, 2009–2020 +<literallayout class="normal">Copyright © 1989, 1991, 1992, 1993, 1996–2005, 2007, 2009–2021 Free Software Foundation, Inc. All Rights Reserved.</literallayout> @end docbook @ifnotdocbook -Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2020 @* +Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2021 @* Free Software Foundation, Inc. @end ifnotdocbook @sp 2 @@ -6993,7 +6993,36 @@ if the input text that could match the trailing part is fairly long. @command{gawk} attempts to avoid this problem, but currently, there's no guarantee that this will never happen. -@quotation NOTE +@cindex sidebar @subentry Caveats When Using Regular Expressions for @code{RS} +@ifdocbook +@docbook +<sidebar><title>Caveats When Using Regular Expressions for @code{RS}</title> +@end docbook + +Remember that in @command{awk}, the @samp{^} and @samp{$} anchor +metacharacters match the beginning and end of a @emph{string}, and not +the beginning and end of a @emph{line}. As a result, something like +@samp{RS = "^[[:upper:]]"} can only match at the beginning of a file. +This is because @command{gawk} views the input file as one long string +that happens to contain newline characters. +It is thus best to avoid anchor metacharacters in the value of @code{RS}. + +Record splitting with regular expressions works differently than +regexp matching with the @code{sub()}, @code{gsub()}, and @code{gensub()} +(@pxref{String Functions}). Those functions allow a regexp to match the empty string; +record splitting does not. Thus, for example @samp{RS = "()"} does @emph{not} +split records between characters. + +@docbook +</sidebar> +@end docbook +@end ifdocbook + +@ifnotdocbook +@cartouche +@center @b{Caveats When Using Regular Expressions for @code{RS}} + + Remember that in @command{awk}, the @samp{^} and @samp{$} anchor metacharacters match the beginning and end of a @emph{string}, and not the beginning and end of a @emph{line}. As a result, something like @@ -7001,7 +7030,14 @@ the beginning and end of a @emph{line}. As a result, something like This is because @command{gawk} views the input file as one long string that happens to contain newline characters. It is thus best to avoid anchor metacharacters in the value of @code{RS}. -@end quotation + +Record splitting with regular expressions works differently than +regexp matching with the @code{sub()}, @code{gsub()}, and @code{gensub()} +(@pxref{String Functions}). Those functions allow a regexp to match the empty string; +record splitting does not. Thus, for example @samp{RS = "()"} does @emph{not} +split records between characters. +@end cartouche +@end ifnotdocbook @cindex @command{gawk} @subentry @code{RT} variable in @cindex @code{RT} variable @@ -7710,6 +7746,12 @@ $ @kbd{echo 'xxAA xxBxx C' |} @print{} -->C<-- @end example +Finally, field splitting with regular expressions works differently than +regexp matching with the @code{sub()}, @code{gsub()}, and @code{gensub()} +(@pxref{String Functions}). Those functions allow a regexp to match the +empty string; field splitting does not. Thus, for example @samp{FS = +"()"} does @emph{not} split fields between characters. + @node Single Character Fields @subsection Making Each Character a Separate Field diff --git a/doc/gawktexi.in b/doc/gawktexi.in index d784d386..3f4ec89d 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -54,7 +54,7 @@ @c applies to and all the info about who's publishing this edition @c These apply across the board. -@set UPDATE-MONTH September, 2020 +@set UPDATE-MONTH January, 2021 @set VERSION 5.1 @set PATCHLEVEL 0 @@ -280,13 +280,13 @@ Fax: +1-617-542-2652 Email: <email>gnu@@gnu.org</email> URL: <ulink url="https://www.gnu.org">https://www.gnu.org/</ulink></literallayout> -<literallayout class="normal">Copyright © 1989, 1991, 1992, 1993, 1996–2005, 2007, 2009–2020 +<literallayout class="normal">Copyright © 1989, 1991, 1992, 1993, 1996–2005, 2007, 2009–2021 Free Software Foundation, Inc. All Rights Reserved.</literallayout> @end docbook @ifnotdocbook -Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2020 @* +Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2021 @* Free Software Foundation, Inc. @end ifnotdocbook @sp 2 @@ -6731,7 +6731,7 @@ if the input text that could match the trailing part is fairly long. @command{gawk} attempts to avoid this problem, but currently, there's no guarantee that this will never happen. -@quotation NOTE +@sidebar Caveats When Using Regular Expressions for @code{RS} Remember that in @command{awk}, the @samp{^} and @samp{$} anchor metacharacters match the beginning and end of a @emph{string}, and not the beginning and end of a @emph{line}. As a result, something like @@ -6739,7 +6739,13 @@ the beginning and end of a @emph{line}. As a result, something like This is because @command{gawk} views the input file as one long string that happens to contain newline characters. It is thus best to avoid anchor metacharacters in the value of @code{RS}. -@end quotation + +Record splitting with regular expressions works differently than +regexp matching with the @code{sub()}, @code{gsub()}, and @code{gensub()} +(@pxref{String Functions}). Those functions allow a regexp to match the empty string; +record splitting does not. Thus, for example @samp{RS = "()"} does @emph{not} +split records between characters. +@end sidebar @cindex @command{gawk} @subentry @code{RT} variable in @cindex @code{RT} variable @@ -7359,6 +7365,12 @@ $ @kbd{echo 'xxAA xxBxx C' |} @print{} -->C<-- @end example +Finally, field splitting with regular expressions works differently than +regexp matching with the @code{sub()}, @code{gsub()}, and @code{gensub()} +(@pxref{String Functions}). Those functions allow a regexp to match the +empty string; field splitting does not. Thus, for example @samp{FS = +"()"} does @emph{not} split fields between characters. + @node Single Character Fields @subsection Making Each Character a Separate Field |