diff options
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 954 | ||||
-rw-r--r-- | doc/gawk.texi | 24 | ||||
-rw-r--r-- | doc/gawktexi.in | 22 |
4 files changed, 518 insertions, 486 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index d5eaa3a0..40ac2eb4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2014-08-16 Arnold D. Robbins <arnold@skeeve.com> + + * gawktexi.in: Continuing on reviewer comments. + 2014-08-15 Arnold D. Robbins <arnold@skeeve.com> * gawktexi.in: Continuing on reviewer comments. diff --git a/doc/gawk.info b/doc/gawk.info index 8f91f3c0..501b8136 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -4817,7 +4817,8 @@ argument to `-F' is `t', then `FS' is set to the TAB character. If you type `-F\t' at the shell, without any quotes, the `\' gets deleted, so `awk' figures that you really want your fields to be separated with TABs and not `t's. Use `-v FS="t"' or `-F"[t]"' on the command line if -you really do want to separate your fields with `t's. +you really do want to separate your fields with `t's. Use `-F '\t'' +when not in compatibility mode to specify that TABs separate fields. As an example, let's use an `awk' program file called `edu.awk' that contains the pattern `/edu/' and the action `print $1': @@ -4937,8 +4938,8 @@ which usually prints: root -on an incorrect implementation of `awk', while `gawk' prints something -like: +on an incorrect implementation of `awk', while `gawk' prints the full +first line of the file, something like: root:nSijPlPhZZwgE:0:0:Root:/: @@ -5018,7 +5019,7 @@ calculated idle time: BEGIN { FIELDWIDTHS = "9 6 10 6 7 7 35" } NR > 2 { idle = $4 - sub(/^ */, "", idle) # strip leading spaces + sub(/^ +/, "", idle) # strip leading spaces if (idle == "") idle = 0 if (idle ~ /:/) { @@ -5149,8 +5150,10 @@ would be to remove the quotes when they occur, with something like this: As with `FS', the `IGNORECASE' variable (*note User-modified::) affects field splitting with `FPAT'. - Similar to `FIELDWIDTHS', the value of `PROCINFO["FS"]' will be -`"FPAT"' if content-based field splitting is being used. + Assigning a value to `FPAT' overrides field splitting with `FS' and +with `FIELDWIDTHS'. Similar to `FIELDWIDTHS', the value of +`PROCINFO["FS"]' will be `"FPAT"' if content-based field splitting is +being used. NOTE: Some programs export CSV data that contains embedded newlines between the double quotes. `gawk' provides no way to @@ -5168,6 +5171,11 @@ changed the first `+' to `*') allows fields to be empty: Finally, the `patsplit()' function makes the same functionality available for splitting regular strings (*note String Functions::). + To recap, `gawk' provides three independent methods to split input +records into fields. `gawk' uses whichever mechanism was last chosen +based on which of the three variables--`FS', `FIELDWIDTHS', and +`FPAT'--was last assigned to. + ---------- Footnotes ---------- (1) At least, we don't know of one. @@ -6755,8 +6763,8 @@ to rename the files. It then sends the list to the shell for execution. File: gawk.info, Node: Special Files, Next: Close Files And Pipes, Prev: Redirection, Up: Printing -5.7 Special File Name in `gawk' -=============================== +5.7 Special File Names in `gawk' +================================ `gawk' provides a number of special file names that it interprets internally. These file names provide access to standard file @@ -8194,7 +8202,7 @@ operands, according to the following symmetric matrix: user input--should be treated as numeric, even though it is actually made of characters and is therefore also a string. Thus, for example, the string constant `" +3.14"', when it appears in program source code, -is a string--even though it looks numeric--and is _never_ treated as +is a string--even though it looks numeric--and is _never_ treated as a number for comparison purposes. In short, when one operand is a "pure" string, such as a string @@ -21605,7 +21613,7 @@ File: gawk.info, Node: FP Math Caution, Next: Arbitrary Precision Integers, P 15.4 Floating Point Arithmetic: Caveat Emptor! ============================================== - Math class is tough! -- Late 1980's Barbie + Math class is tough! -- Teen Talk Barbie (July, 1992) This minor node provides a high level overview of the issues involved when doing lots of floating-point arithmetic.(1) The @@ -22167,7 +22175,7 @@ File: gawk.info, Node: Floating point summary, Prev: POSIX Floating Point Prob floating-point values. The default for `awk' is to use double-precision floating-point values. - * In the 1980's, Barbie mistakenly said "Math class is tough!" + * In the early 1990's, Barbie mistakenly said "Math class is tough!" While math isn't tough, floating-point arithmetic isn't the same as pencil and paper math, and care must be taken: @@ -33379,7 +33387,7 @@ Index * Robbins, Arnold <6>: Passwd Functions. (line 90) * Robbins, Arnold <7>: Getline/Pipe. (line 39) * Robbins, Arnold: Command Line Field Separator. - (line 73) + (line 74) * Robbins, Bill: Getline/Pipe. (line 39) * Robbins, Harry: Acknowledgments. (line 92) * Robbins, Jean: Acknowledgments. (line 92) @@ -33794,7 +33802,7 @@ Index * Unix awk, close() function and: Close Files And Pipes. (line 131) * Unix awk, password files, field separators and: Command Line Field Separator. - (line 64) + (line 65) * Unix, awk scripts and: Executable Scripts. (line 6) * UNIXROOT variable, on OS/2 systems: PC Using. (line 16) * unsigned integers: Computer Arithmetic. (line 41) @@ -34020,465 +34028,465 @@ Node: Default Field Splitting210302 Node: Regexp Field Splitting211419 Node: Single Character Fields214760 Node: Command Line Field Separator215819 -Node: Full Line Fields219161 -Ref: Full Line Fields-Footnote-1219669 -Node: Field Splitting Summary219715 -Ref: Field Splitting Summary-Footnote-1222814 -Node: Constant Size222915 -Node: Splitting By Content227522 -Ref: Splitting By Content-Footnote-1231272 -Node: Multiple Line231312 -Ref: Multiple Line-Footnote-1237168 -Node: Getline237347 -Node: Plain Getline239563 -Node: Getline/Variable241658 -Node: Getline/File242805 -Node: Getline/Variable/File244189 -Ref: Getline/Variable/File-Footnote-1245788 -Node: Getline/Pipe245875 -Node: Getline/Variable/Pipe248574 -Node: Getline/Coprocess249681 -Node: Getline/Variable/Coprocess250933 -Node: Getline Notes251670 -Node: Getline Summary254474 -Ref: table-getline-variants254882 -Node: Read Timeout255794 -Ref: Read Timeout-Footnote-1259621 -Node: Command-line directories259679 -Node: Input Summary260583 -Node: Input Exercises263720 -Node: Printing264453 -Node: Print266175 -Node: Print Examples267516 -Node: Output Separators270295 -Node: OFMT272311 -Node: Printf273669 -Node: Basic Printf274575 -Node: Control Letters276114 -Node: Format Modifiers280105 -Node: Printf Examples286132 -Node: Redirection288596 -Node: Special Files295568 -Node: Special FD296099 -Ref: Special FD-Footnote-1299696 -Node: Special Network299770 -Node: Special Caveats300620 -Node: Close Files And Pipes301416 -Ref: Close Files And Pipes-Footnote-1308577 -Ref: Close Files And Pipes-Footnote-2308725 -Node: Output Summary308875 -Node: Output exercises309872 -Node: Expressions310552 -Node: Values311737 -Node: Constants312413 -Node: Scalar Constants313093 -Ref: Scalar Constants-Footnote-1313952 -Node: Nondecimal-numbers314202 -Node: Regexp Constants317202 -Node: Using Constant Regexps317677 -Node: Variables320749 -Node: Using Variables321404 -Node: Assignment Options323128 -Node: Conversion325003 -Node: Strings And Numbers325527 -Ref: Strings And Numbers-Footnote-1328589 -Node: Locale influences conversions328698 -Ref: table-locale-affects331415 -Node: All Operators332003 -Node: Arithmetic Ops332633 -Node: Concatenation335138 -Ref: Concatenation-Footnote-1337957 -Node: Assignment Ops338077 -Ref: table-assign-ops343060 -Node: Increment Ops344377 -Node: Truth Values and Conditions347815 -Node: Truth Values348898 -Node: Typing and Comparison349947 -Node: Variable Typing350740 -Node: Comparison Operators354390 -Ref: table-relational-ops354800 -Node: POSIX String Comparison358350 -Ref: POSIX String Comparison-Footnote-1359434 -Node: Boolean Ops359572 -Ref: Boolean Ops-Footnote-1363642 -Node: Conditional Exp363733 -Node: Function Calls365460 -Node: Precedence369340 -Node: Locales373009 -Node: Expressions Summary374640 -Node: Patterns and Actions377181 -Node: Pattern Overview378297 -Node: Regexp Patterns379974 -Node: Expression Patterns380517 -Node: Ranges384298 -Node: BEGIN/END387404 -Node: Using BEGIN/END388166 -Ref: Using BEGIN/END-Footnote-1390902 -Node: I/O And BEGIN/END391008 -Node: BEGINFILE/ENDFILE393293 -Node: Empty396224 -Node: Using Shell Variables396541 -Node: Action Overview398824 -Node: Statements401151 -Node: If Statement402999 -Node: While Statement404497 -Node: Do Statement406541 -Node: For Statement407697 -Node: Switch Statement410849 -Node: Break Statement412952 -Node: Continue Statement415007 -Node: Next Statement416800 -Node: Nextfile Statement419190 -Node: Exit Statement421845 -Node: Built-in Variables424249 -Node: User-modified425376 -Ref: User-modified-Footnote-1433065 -Node: Auto-set433127 -Ref: Auto-set-Footnote-1445709 -Ref: Auto-set-Footnote-2445914 -Node: ARGC and ARGV445970 -Node: Pattern Action Summary449824 -Node: Arrays452047 -Node: Array Basics453596 -Node: Array Intro454422 -Ref: figure-array-elements456395 -Node: Reference to Elements458802 -Node: Assigning Elements461075 -Node: Array Example461566 -Node: Scanning an Array463298 -Node: Controlling Scanning466313 -Ref: Controlling Scanning-Footnote-1471486 -Node: Delete471802 -Ref: Delete-Footnote-1474567 -Node: Numeric Array Subscripts474624 -Node: Uninitialized Subscripts476807 -Node: Multidimensional478432 -Node: Multiscanning481525 -Node: Arrays of Arrays483114 -Node: Arrays Summary487777 -Node: Functions489882 -Node: Built-in490755 -Node: Calling Built-in491833 -Node: Numeric Functions493821 -Ref: Numeric Functions-Footnote-1497763 -Ref: Numeric Functions-Footnote-2498120 -Ref: Numeric Functions-Footnote-3498168 -Node: String Functions498437 -Ref: String Functions-Footnote-1521448 -Ref: String Functions-Footnote-2521577 -Ref: String Functions-Footnote-3521825 -Node: Gory Details521912 -Ref: table-sub-escapes523699 -Ref: table-sub-proposed525219 -Ref: table-posix-sub526583 -Ref: table-gensub-escapes528123 -Ref: Gory Details-Footnote-1529299 -Node: I/O Functions529450 -Ref: I/O Functions-Footnote-1536573 -Node: Time Functions536720 -Ref: Time Functions-Footnote-1547184 -Ref: Time Functions-Footnote-2547252 -Ref: Time Functions-Footnote-3547410 -Ref: Time Functions-Footnote-4547521 -Ref: Time Functions-Footnote-5547633 -Ref: Time Functions-Footnote-6547860 -Node: Bitwise Functions548126 -Ref: table-bitwise-ops548688 -Ref: Bitwise Functions-Footnote-1552933 -Node: Type Functions553117 -Node: I18N Functions554259 -Node: User-defined555904 -Node: Definition Syntax556708 -Ref: Definition Syntax-Footnote-1561887 -Node: Function Example561956 -Ref: Function Example-Footnote-1564520 -Node: Function Caveats564542 -Node: Calling A Function565060 -Node: Variable Scope566015 -Node: Pass By Value/Reference569003 -Node: Return Statement572513 -Node: Dynamic Typing575497 -Node: Indirect Calls576426 -Node: Functions Summary586139 -Node: Library Functions588678 -Ref: Library Functions-Footnote-1592296 -Ref: Library Functions-Footnote-2592439 -Node: Library Names592610 -Ref: Library Names-Footnote-1596083 -Ref: Library Names-Footnote-2596303 -Node: General Functions596389 -Node: Strtonum Function597417 -Node: Assert Function600197 -Node: Round Function603523 -Node: Cliff Random Function605064 -Node: Ordinal Functions606080 -Ref: Ordinal Functions-Footnote-1609157 -Ref: Ordinal Functions-Footnote-2609409 -Node: Join Function609620 -Ref: Join Function-Footnote-1611391 -Node: Getlocaltime Function611591 -Node: Readfile Function615327 -Node: Data File Management617166 -Node: Filetrans Function617798 -Node: Rewind Function621867 -Node: File Checking623425 -Ref: File Checking-Footnote-1624557 -Node: Empty Files624758 -Node: Ignoring Assigns626737 -Node: Getopt Function628291 -Ref: Getopt Function-Footnote-1639594 -Node: Passwd Functions639797 -Ref: Passwd Functions-Footnote-1648776 -Node: Group Functions648864 -Ref: Group Functions-Footnote-1656805 -Node: Walking Arrays657018 -Node: Library Functions Summary658621 -Node: Library exercises660009 -Node: Sample Programs661289 -Node: Running Examples662059 -Node: Clones662787 -Node: Cut Program664011 -Node: Egrep Program673879 -Ref: Egrep Program-Footnote-1681850 -Node: Id Program681960 -Node: Split Program685624 -Ref: Split Program-Footnote-1689162 -Node: Tee Program689290 -Node: Uniq Program692097 -Node: Wc Program699527 -Ref: Wc Program-Footnote-1703792 -Node: Miscellaneous Programs703884 -Node: Dupword Program705097 -Node: Alarm Program707128 -Node: Translate Program711942 -Ref: Translate Program-Footnote-1716333 -Ref: Translate Program-Footnote-2716603 -Node: Labels Program716737 -Ref: Labels Program-Footnote-1720108 -Node: Word Sorting720192 -Node: History Sorting724235 -Node: Extract Program726071 -Node: Simple Sed733607 -Node: Igawk Program736669 -Ref: Igawk Program-Footnote-1750980 -Ref: Igawk Program-Footnote-2751181 -Node: Anagram Program751319 -Node: Signature Program754387 -Node: Programs Summary755634 -Node: Programs Exercises756849 -Node: Advanced Features760500 -Node: Nondecimal Data762448 -Node: Array Sorting764025 -Node: Controlling Array Traversal764722 -Node: Array Sorting Functions773002 -Ref: Array Sorting Functions-Footnote-1776909 -Node: Two-way I/O777103 -Ref: Two-way I/O-Footnote-1782047 -Ref: Two-way I/O-Footnote-2782226 -Node: TCP/IP Networking782308 -Node: Profiling785153 -Node: Advanced Features Summary792695 -Node: Internationalization794559 -Node: I18N and L10N796039 -Node: Explaining gettext796725 -Ref: Explaining gettext-Footnote-1801865 -Ref: Explaining gettext-Footnote-2802049 -Node: Programmer i18n802214 -Node: Translator i18n806439 -Node: String Extraction807233 -Ref: String Extraction-Footnote-1808194 -Node: Printf Ordering808280 -Ref: Printf Ordering-Footnote-1811062 -Node: I18N Portability811126 -Ref: I18N Portability-Footnote-1813575 -Node: I18N Example813638 -Ref: I18N Example-Footnote-1816360 -Node: Gawk I18N816432 -Node: I18N Summary817070 -Node: Debugger818409 -Node: Debugging819431 -Node: Debugging Concepts819872 -Node: Debugging Terms821728 -Node: Awk Debugging824325 -Node: Sample Debugging Session825217 -Node: Debugger Invocation825737 -Node: Finding The Bug827070 -Node: List of Debugger Commands833552 -Node: Breakpoint Control834884 -Node: Debugger Execution Control838548 -Node: Viewing And Changing Data841908 -Node: Execution Stack845266 -Node: Debugger Info846779 -Node: Miscellaneous Debugger Commands850773 -Node: Readline Support855957 -Node: Limitations856849 -Node: Debugging Summary859123 -Node: Arbitrary Precision Arithmetic860287 -Node: Computer Arithmetic861774 -Ref: Computer Arithmetic-Footnote-1866161 -Node: Math Definitions866218 -Ref: table-ieee-formats869507 -Ref: Math Definitions-Footnote-1870047 -Node: MPFR features870150 -Node: FP Math Caution871792 -Ref: FP Math Caution-Footnote-1872833 -Node: Inexactness of computations873202 -Node: Inexact representation874150 -Node: Comparing FP Values875505 -Node: Errors accumulate876469 -Node: Getting Accuracy877902 -Node: Try To Round880561 -Node: Setting precision881460 -Ref: table-predefined-precision-strings882142 -Node: Setting the rounding mode883935 -Ref: table-gawk-rounding-modes884299 -Ref: Setting the rounding mode-Footnote-1887753 -Node: Arbitrary Precision Integers887932 -Ref: Arbitrary Precision Integers-Footnote-1890935 -Node: POSIX Floating Point Problems891084 -Ref: POSIX Floating Point Problems-Footnote-1894960 -Node: Floating point summary894998 -Node: Dynamic Extensions897215 -Node: Extension Intro898767 -Node: Plugin License900032 -Node: Extension Mechanism Outline900717 -Ref: figure-load-extension901141 -Ref: figure-load-new-function902626 -Ref: figure-call-new-function903628 -Node: Extension API Description905612 -Node: Extension API Functions Introduction907062 -Node: General Data Types911927 -Ref: General Data Types-Footnote-1917620 -Node: Requesting Values917919 -Ref: table-value-types-returned918656 -Node: Memory Allocation Functions919614 -Ref: Memory Allocation Functions-Footnote-1922361 -Node: Constructor Functions922457 -Node: Registration Functions924215 -Node: Extension Functions924900 -Node: Exit Callback Functions927202 -Node: Extension Version String928451 -Node: Input Parsers929101 -Node: Output Wrappers938915 -Node: Two-way processors943431 -Node: Printing Messages945635 -Ref: Printing Messages-Footnote-1946712 -Node: Updating `ERRNO'946864 -Node: Accessing Parameters947603 -Node: Symbol Table Access948833 -Node: Symbol table by name949347 -Node: Symbol table by cookie951323 -Ref: Symbol table by cookie-Footnote-1955456 -Node: Cached values955519 -Ref: Cached values-Footnote-1959023 -Node: Array Manipulation959114 -Ref: Array Manipulation-Footnote-1960212 -Node: Array Data Types960251 -Ref: Array Data Types-Footnote-1962954 -Node: Array Functions963046 -Node: Flattening Arrays966920 -Node: Creating Arrays973772 -Node: Extension API Variables978503 -Node: Extension Versioning979139 -Node: Extension API Informational Variables981040 -Node: Extension API Boilerplate982126 -Node: Finding Extensions985930 -Node: Extension Example986490 -Node: Internal File Description987220 -Node: Internal File Ops991311 -Ref: Internal File Ops-Footnote-11002743 -Node: Using Internal File Ops1002883 -Ref: Using Internal File Ops-Footnote-11005230 -Node: Extension Samples1005498 -Node: Extension Sample File Functions1007022 -Node: Extension Sample Fnmatch1014590 -Node: Extension Sample Fork1016072 -Node: Extension Sample Inplace1017285 -Node: Extension Sample Ord1018960 -Node: Extension Sample Readdir1019796 -Ref: table-readdir-file-types1020652 -Node: Extension Sample Revout1021451 -Node: Extension Sample Rev2way1022042 -Node: Extension Sample Read write array1022783 -Node: Extension Sample Readfile1024662 -Node: Extension Sample API Tests1025762 -Node: Extension Sample Time1026287 -Node: gawkextlib1027602 -Node: Extension summary1030415 -Node: Extension Exercises1034108 -Node: Language History1034830 -Node: V7/SVR3.11036473 -Node: SVR41038793 -Node: POSIX1040235 -Node: BTL1041621 -Node: POSIX/GNU1042355 -Node: Feature History1048098 -Node: Common Extensions1061228 -Node: Ranges and Locales1062540 -Ref: Ranges and Locales-Footnote-11067157 -Ref: Ranges and Locales-Footnote-21067184 -Ref: Ranges and Locales-Footnote-31067418 -Node: Contributors1067639 -Node: History summary1073064 -Node: Installation1074433 -Node: Gawk Distribution1075384 -Node: Getting1075868 -Node: Extracting1076692 -Node: Distribution contents1078334 -Node: Unix Installation1084051 -Node: Quick Installation1084668 -Node: Additional Configuration Options1087110 -Node: Configuration Philosophy1088848 -Node: Non-Unix Installation1091199 -Node: PC Installation1091657 -Node: PC Binary Installation1092968 -Node: PC Compiling1094816 -Ref: PC Compiling-Footnote-11097815 -Node: PC Testing1097920 -Node: PC Using1099096 -Node: Cygwin1103254 -Node: MSYS1104063 -Node: VMS Installation1104577 -Node: VMS Compilation1105373 -Ref: VMS Compilation-Footnote-11106595 -Node: VMS Dynamic Extensions1106653 -Node: VMS Installation Details1108026 -Node: VMS Running1110278 -Node: VMS GNV1113112 -Node: VMS Old Gawk1113835 -Node: Bugs1114305 -Node: Other Versions1118309 -Node: Installation summary1124564 -Node: Notes1125620 -Node: Compatibility Mode1126485 -Node: Additions1127267 -Node: Accessing The Source1128192 -Node: Adding Code1129628 -Node: New Ports1135806 -Node: Derived Files1140287 -Ref: Derived Files-Footnote-11145368 -Ref: Derived Files-Footnote-21145402 -Ref: Derived Files-Footnote-31145998 -Node: Future Extensions1146112 -Node: Implementation Limitations1146718 -Node: Extension Design1147966 -Node: Old Extension Problems1149120 -Ref: Old Extension Problems-Footnote-11150637 -Node: Extension New Mechanism Goals1150694 -Ref: Extension New Mechanism Goals-Footnote-11154054 -Node: Extension Other Design Decisions1154243 -Node: Extension Future Growth1156349 -Node: Old Extension Mechanism1157185 -Node: Notes summary1158947 -Node: Basic Concepts1160133 -Node: Basic High Level1160814 -Ref: figure-general-flow1161086 -Ref: figure-process-flow1161685 -Ref: Basic High Level-Footnote-11164914 -Node: Basic Data Typing1165099 -Node: Glossary1168427 -Node: Copying1193579 -Node: GNU Free Documentation License1231135 -Node: Index1256271 +Node: Full Line Fields219245 +Ref: Full Line Fields-Footnote-1219753 +Node: Field Splitting Summary219799 +Ref: Field Splitting Summary-Footnote-1222931 +Node: Constant Size223032 +Node: Splitting By Content227638 +Ref: Splitting By Content-Footnote-1231711 +Node: Multiple Line231751 +Ref: Multiple Line-Footnote-1237607 +Node: Getline237786 +Node: Plain Getline240002 +Node: Getline/Variable242097 +Node: Getline/File243244 +Node: Getline/Variable/File244628 +Ref: Getline/Variable/File-Footnote-1246227 +Node: Getline/Pipe246314 +Node: Getline/Variable/Pipe249013 +Node: Getline/Coprocess250120 +Node: Getline/Variable/Coprocess251372 +Node: Getline Notes252109 +Node: Getline Summary254913 +Ref: table-getline-variants255321 +Node: Read Timeout256233 +Ref: Read Timeout-Footnote-1260060 +Node: Command-line directories260118 +Node: Input Summary261022 +Node: Input Exercises264159 +Node: Printing264892 +Node: Print266614 +Node: Print Examples267955 +Node: Output Separators270734 +Node: OFMT272750 +Node: Printf274108 +Node: Basic Printf275014 +Node: Control Letters276553 +Node: Format Modifiers280544 +Node: Printf Examples286571 +Node: Redirection289035 +Node: Special Files296007 +Node: Special FD296540 +Ref: Special FD-Footnote-1300137 +Node: Special Network300211 +Node: Special Caveats301061 +Node: Close Files And Pipes301857 +Ref: Close Files And Pipes-Footnote-1309018 +Ref: Close Files And Pipes-Footnote-2309166 +Node: Output Summary309316 +Node: Output exercises310313 +Node: Expressions310993 +Node: Values312178 +Node: Constants312854 +Node: Scalar Constants313534 +Ref: Scalar Constants-Footnote-1314393 +Node: Nondecimal-numbers314643 +Node: Regexp Constants317643 +Node: Using Constant Regexps318118 +Node: Variables321190 +Node: Using Variables321845 +Node: Assignment Options323569 +Node: Conversion325444 +Node: Strings And Numbers325968 +Ref: Strings And Numbers-Footnote-1329030 +Node: Locale influences conversions329139 +Ref: table-locale-affects331856 +Node: All Operators332444 +Node: Arithmetic Ops333074 +Node: Concatenation335579 +Ref: Concatenation-Footnote-1338398 +Node: Assignment Ops338518 +Ref: table-assign-ops343501 +Node: Increment Ops344818 +Node: Truth Values and Conditions348256 +Node: Truth Values349339 +Node: Typing and Comparison350388 +Node: Variable Typing351181 +Node: Comparison Operators354833 +Ref: table-relational-ops355243 +Node: POSIX String Comparison358793 +Ref: POSIX String Comparison-Footnote-1359877 +Node: Boolean Ops360015 +Ref: Boolean Ops-Footnote-1364085 +Node: Conditional Exp364176 +Node: Function Calls365903 +Node: Precedence369783 +Node: Locales373452 +Node: Expressions Summary375083 +Node: Patterns and Actions377624 +Node: Pattern Overview378740 +Node: Regexp Patterns380417 +Node: Expression Patterns380960 +Node: Ranges384741 +Node: BEGIN/END387847 +Node: Using BEGIN/END388609 +Ref: Using BEGIN/END-Footnote-1391345 +Node: I/O And BEGIN/END391451 +Node: BEGINFILE/ENDFILE393736 +Node: Empty396667 +Node: Using Shell Variables396984 +Node: Action Overview399267 +Node: Statements401594 +Node: If Statement403442 +Node: While Statement404940 +Node: Do Statement406984 +Node: For Statement408140 +Node: Switch Statement411292 +Node: Break Statement413395 +Node: Continue Statement415450 +Node: Next Statement417243 +Node: Nextfile Statement419633 +Node: Exit Statement422288 +Node: Built-in Variables424692 +Node: User-modified425819 +Ref: User-modified-Footnote-1433508 +Node: Auto-set433570 +Ref: Auto-set-Footnote-1446152 +Ref: Auto-set-Footnote-2446357 +Node: ARGC and ARGV446413 +Node: Pattern Action Summary450267 +Node: Arrays452490 +Node: Array Basics454039 +Node: Array Intro454865 +Ref: figure-array-elements456838 +Node: Reference to Elements459245 +Node: Assigning Elements461518 +Node: Array Example462009 +Node: Scanning an Array463741 +Node: Controlling Scanning466756 +Ref: Controlling Scanning-Footnote-1471929 +Node: Delete472245 +Ref: Delete-Footnote-1475010 +Node: Numeric Array Subscripts475067 +Node: Uninitialized Subscripts477250 +Node: Multidimensional478875 +Node: Multiscanning481968 +Node: Arrays of Arrays483557 +Node: Arrays Summary488220 +Node: Functions490325 +Node: Built-in491198 +Node: Calling Built-in492276 +Node: Numeric Functions494264 +Ref: Numeric Functions-Footnote-1498206 +Ref: Numeric Functions-Footnote-2498563 +Ref: Numeric Functions-Footnote-3498611 +Node: String Functions498880 +Ref: String Functions-Footnote-1521891 +Ref: String Functions-Footnote-2522020 +Ref: String Functions-Footnote-3522268 +Node: Gory Details522355 +Ref: table-sub-escapes524142 +Ref: table-sub-proposed525662 +Ref: table-posix-sub527026 +Ref: table-gensub-escapes528566 +Ref: Gory Details-Footnote-1529742 +Node: I/O Functions529893 +Ref: I/O Functions-Footnote-1537016 +Node: Time Functions537163 +Ref: Time Functions-Footnote-1547627 +Ref: Time Functions-Footnote-2547695 +Ref: Time Functions-Footnote-3547853 +Ref: Time Functions-Footnote-4547964 +Ref: Time Functions-Footnote-5548076 +Ref: Time Functions-Footnote-6548303 +Node: Bitwise Functions548569 +Ref: table-bitwise-ops549131 +Ref: Bitwise Functions-Footnote-1553376 +Node: Type Functions553560 +Node: I18N Functions554702 +Node: User-defined556347 +Node: Definition Syntax557151 +Ref: Definition Syntax-Footnote-1562330 +Node: Function Example562399 +Ref: Function Example-Footnote-1564963 +Node: Function Caveats564985 +Node: Calling A Function565503 +Node: Variable Scope566458 +Node: Pass By Value/Reference569446 +Node: Return Statement572956 +Node: Dynamic Typing575940 +Node: Indirect Calls576869 +Node: Functions Summary586582 +Node: Library Functions589121 +Ref: Library Functions-Footnote-1592739 +Ref: Library Functions-Footnote-2592882 +Node: Library Names593053 +Ref: Library Names-Footnote-1596526 +Ref: Library Names-Footnote-2596746 +Node: General Functions596832 +Node: Strtonum Function597860 +Node: Assert Function600640 +Node: Round Function603966 +Node: Cliff Random Function605507 +Node: Ordinal Functions606523 +Ref: Ordinal Functions-Footnote-1609600 +Ref: Ordinal Functions-Footnote-2609852 +Node: Join Function610063 +Ref: Join Function-Footnote-1611834 +Node: Getlocaltime Function612034 +Node: Readfile Function615770 +Node: Data File Management617609 +Node: Filetrans Function618241 +Node: Rewind Function622310 +Node: File Checking623868 +Ref: File Checking-Footnote-1625000 +Node: Empty Files625201 +Node: Ignoring Assigns627180 +Node: Getopt Function628734 +Ref: Getopt Function-Footnote-1640037 +Node: Passwd Functions640240 +Ref: Passwd Functions-Footnote-1649219 +Node: Group Functions649307 +Ref: Group Functions-Footnote-1657248 +Node: Walking Arrays657461 +Node: Library Functions Summary659064 +Node: Library exercises660452 +Node: Sample Programs661732 +Node: Running Examples662502 +Node: Clones663230 +Node: Cut Program664454 +Node: Egrep Program674322 +Ref: Egrep Program-Footnote-1682293 +Node: Id Program682403 +Node: Split Program686067 +Ref: Split Program-Footnote-1689605 +Node: Tee Program689733 +Node: Uniq Program692540 +Node: Wc Program699970 +Ref: Wc Program-Footnote-1704235 +Node: Miscellaneous Programs704327 +Node: Dupword Program705540 +Node: Alarm Program707571 +Node: Translate Program712385 +Ref: Translate Program-Footnote-1716776 +Ref: Translate Program-Footnote-2717046 +Node: Labels Program717180 +Ref: Labels Program-Footnote-1720551 +Node: Word Sorting720635 +Node: History Sorting724678 +Node: Extract Program726514 +Node: Simple Sed734050 +Node: Igawk Program737112 +Ref: Igawk Program-Footnote-1751423 +Ref: Igawk Program-Footnote-2751624 +Node: Anagram Program751762 +Node: Signature Program754830 +Node: Programs Summary756077 +Node: Programs Exercises757292 +Node: Advanced Features760943 +Node: Nondecimal Data762891 +Node: Array Sorting764468 +Node: Controlling Array Traversal765165 +Node: Array Sorting Functions773445 +Ref: Array Sorting Functions-Footnote-1777352 +Node: Two-way I/O777546 +Ref: Two-way I/O-Footnote-1782490 +Ref: Two-way I/O-Footnote-2782669 +Node: TCP/IP Networking782751 +Node: Profiling785596 +Node: Advanced Features Summary793138 +Node: Internationalization795002 +Node: I18N and L10N796482 +Node: Explaining gettext797168 +Ref: Explaining gettext-Footnote-1802308 +Ref: Explaining gettext-Footnote-2802492 +Node: Programmer i18n802657 +Node: Translator i18n806882 +Node: String Extraction807676 +Ref: String Extraction-Footnote-1808637 +Node: Printf Ordering808723 +Ref: Printf Ordering-Footnote-1811505 +Node: I18N Portability811569 +Ref: I18N Portability-Footnote-1814018 +Node: I18N Example814081 +Ref: I18N Example-Footnote-1816803 +Node: Gawk I18N816875 +Node: I18N Summary817513 +Node: Debugger818852 +Node: Debugging819874 +Node: Debugging Concepts820315 +Node: Debugging Terms822171 +Node: Awk Debugging824768 +Node: Sample Debugging Session825660 +Node: Debugger Invocation826180 +Node: Finding The Bug827513 +Node: List of Debugger Commands833995 +Node: Breakpoint Control835327 +Node: Debugger Execution Control838991 +Node: Viewing And Changing Data842351 +Node: Execution Stack845709 +Node: Debugger Info847222 +Node: Miscellaneous Debugger Commands851216 +Node: Readline Support856400 +Node: Limitations857292 +Node: Debugging Summary859566 +Node: Arbitrary Precision Arithmetic860730 +Node: Computer Arithmetic862217 +Ref: Computer Arithmetic-Footnote-1866604 +Node: Math Definitions866661 +Ref: table-ieee-formats869950 +Ref: Math Definitions-Footnote-1870490 +Node: MPFR features870593 +Node: FP Math Caution872235 +Ref: FP Math Caution-Footnote-1873287 +Node: Inexactness of computations873656 +Node: Inexact representation874604 +Node: Comparing FP Values875959 +Node: Errors accumulate876923 +Node: Getting Accuracy878356 +Node: Try To Round881015 +Node: Setting precision881914 +Ref: table-predefined-precision-strings882596 +Node: Setting the rounding mode884389 +Ref: table-gawk-rounding-modes884753 +Ref: Setting the rounding mode-Footnote-1888207 +Node: Arbitrary Precision Integers888386 +Ref: Arbitrary Precision Integers-Footnote-1891389 +Node: POSIX Floating Point Problems891538 +Ref: POSIX Floating Point Problems-Footnote-1895414 +Node: Floating point summary895452 +Node: Dynamic Extensions897675 +Node: Extension Intro899227 +Node: Plugin License900492 +Node: Extension Mechanism Outline901177 +Ref: figure-load-extension901601 +Ref: figure-load-new-function903086 +Ref: figure-call-new-function904088 +Node: Extension API Description906072 +Node: Extension API Functions Introduction907522 +Node: General Data Types912387 +Ref: General Data Types-Footnote-1918080 +Node: Requesting Values918379 +Ref: table-value-types-returned919116 +Node: Memory Allocation Functions920074 +Ref: Memory Allocation Functions-Footnote-1922821 +Node: Constructor Functions922917 +Node: Registration Functions924675 +Node: Extension Functions925360 +Node: Exit Callback Functions927662 +Node: Extension Version String928911 +Node: Input Parsers929561 +Node: Output Wrappers939375 +Node: Two-way processors943891 +Node: Printing Messages946095 +Ref: Printing Messages-Footnote-1947172 +Node: Updating `ERRNO'947324 +Node: Accessing Parameters948063 +Node: Symbol Table Access949293 +Node: Symbol table by name949807 +Node: Symbol table by cookie951783 +Ref: Symbol table by cookie-Footnote-1955916 +Node: Cached values955979 +Ref: Cached values-Footnote-1959483 +Node: Array Manipulation959574 +Ref: Array Manipulation-Footnote-1960672 +Node: Array Data Types960711 +Ref: Array Data Types-Footnote-1963414 +Node: Array Functions963506 +Node: Flattening Arrays967380 +Node: Creating Arrays974232 +Node: Extension API Variables978963 +Node: Extension Versioning979599 +Node: Extension API Informational Variables981500 +Node: Extension API Boilerplate982586 +Node: Finding Extensions986390 +Node: Extension Example986950 +Node: Internal File Description987680 +Node: Internal File Ops991771 +Ref: Internal File Ops-Footnote-11003203 +Node: Using Internal File Ops1003343 +Ref: Using Internal File Ops-Footnote-11005690 +Node: Extension Samples1005958 +Node: Extension Sample File Functions1007482 +Node: Extension Sample Fnmatch1015050 +Node: Extension Sample Fork1016532 +Node: Extension Sample Inplace1017745 +Node: Extension Sample Ord1019420 +Node: Extension Sample Readdir1020256 +Ref: table-readdir-file-types1021112 +Node: Extension Sample Revout1021911 +Node: Extension Sample Rev2way1022502 +Node: Extension Sample Read write array1023243 +Node: Extension Sample Readfile1025122 +Node: Extension Sample API Tests1026222 +Node: Extension Sample Time1026747 +Node: gawkextlib1028062 +Node: Extension summary1030875 +Node: Extension Exercises1034568 +Node: Language History1035290 +Node: V7/SVR3.11036933 +Node: SVR41039253 +Node: POSIX1040695 +Node: BTL1042081 +Node: POSIX/GNU1042815 +Node: Feature History1048558 +Node: Common Extensions1061688 +Node: Ranges and Locales1063000 +Ref: Ranges and Locales-Footnote-11067617 +Ref: Ranges and Locales-Footnote-21067644 +Ref: Ranges and Locales-Footnote-31067878 +Node: Contributors1068099 +Node: History summary1073524 +Node: Installation1074893 +Node: Gawk Distribution1075844 +Node: Getting1076328 +Node: Extracting1077152 +Node: Distribution contents1078794 +Node: Unix Installation1084511 +Node: Quick Installation1085128 +Node: Additional Configuration Options1087570 +Node: Configuration Philosophy1089308 +Node: Non-Unix Installation1091659 +Node: PC Installation1092117 +Node: PC Binary Installation1093428 +Node: PC Compiling1095276 +Ref: PC Compiling-Footnote-11098275 +Node: PC Testing1098380 +Node: PC Using1099556 +Node: Cygwin1103714 +Node: MSYS1104523 +Node: VMS Installation1105037 +Node: VMS Compilation1105833 +Ref: VMS Compilation-Footnote-11107055 +Node: VMS Dynamic Extensions1107113 +Node: VMS Installation Details1108486 +Node: VMS Running1110738 +Node: VMS GNV1113572 +Node: VMS Old Gawk1114295 +Node: Bugs1114765 +Node: Other Versions1118769 +Node: Installation summary1125024 +Node: Notes1126080 +Node: Compatibility Mode1126945 +Node: Additions1127727 +Node: Accessing The Source1128652 +Node: Adding Code1130088 +Node: New Ports1136266 +Node: Derived Files1140747 +Ref: Derived Files-Footnote-11145828 +Ref: Derived Files-Footnote-21145862 +Ref: Derived Files-Footnote-31146458 +Node: Future Extensions1146572 +Node: Implementation Limitations1147178 +Node: Extension Design1148426 +Node: Old Extension Problems1149580 +Ref: Old Extension Problems-Footnote-11151097 +Node: Extension New Mechanism Goals1151154 +Ref: Extension New Mechanism Goals-Footnote-11154514 +Node: Extension Other Design Decisions1154703 +Node: Extension Future Growth1156809 +Node: Old Extension Mechanism1157645 +Node: Notes summary1159407 +Node: Basic Concepts1160593 +Node: Basic High Level1161274 +Ref: figure-general-flow1161546 +Ref: figure-process-flow1162145 +Ref: Basic High Level-Footnote-11165374 +Node: Basic Data Typing1165559 +Node: Glossary1168887 +Node: Copying1194039 +Node: GNU Free Documentation License1231595 +Node: Index1256731 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 2a5565c9..c30c2808 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -7149,6 +7149,8 @@ shell, without any quotes, the @samp{\} gets deleted, so @command{awk} figures that you really want your fields to be separated with TABs and not @samp{t}s. Use @samp{-v FS="t"} or @samp{-F"[t]"} on the command line if you really do want to separate your fields with @samp{t}s. +Use @samp{-F '\t'} when not in compatibility mode to specify that TABs +separate fields. As an example, let's use an @command{awk} program file called @file{edu.awk} that contains the pattern @code{/edu/} and the action @samp{print $1}: @@ -7299,7 +7301,7 @@ root @noindent on an incorrect implementation of @command{awk}, while @command{gawk} -prints something like: +prints the full first line of the file, something like: @example root:nSijPlPhZZwgE:0:0:Root:/: @@ -7352,7 +7354,7 @@ root @noindent on an incorrect implementation of @command{awk}, while @command{gawk} -prints something like: +prints the full first line of the file, something like: @example root:nSijPlPhZZwgE:0:0:Root:/: @@ -7489,7 +7491,7 @@ haven't been introduced yet. BEGIN @{ FIELDWIDTHS = "9 6 10 6 7 7 35" @} NR > 2 @{ idle = $4 - sub(/^ */, "", idle) # strip leading spaces + sub(/^ +/, "", idle) # strip leading spaces if (idle == "") idle = 0 if (idle ~ /:/) @{ @@ -7647,6 +7649,8 @@ if (substr($i, 1, 1) == "\"") @{ As with @code{FS}, the @code{IGNORECASE} variable (@pxref{User-modified}) affects field splitting with @code{FPAT}. +Assigning a value to @code{FPAT} overrides field splitting +with @code{FS} and with @code{FIELDWIDTHS}. Similar to @code{FIELDWIDTHS}, the value of @code{PROCINFO["FS"]} will be @code{"FPAT"} if content-based field splitting is being used. @@ -7670,6 +7674,12 @@ FPAT = "([^,]*)|(\"[^\"]+\")" Finally, the @code{patsplit()} function makes the same functionality available for splitting regular strings (@pxref{String Functions}). +To recap, @command{gawk} provides three independent methods +to split input records into fields. @command{gawk} uses whichever +mechanism was last chosen based on which of the three +variables---@code{FS}, @code{FIELDWIDTHS}, and @code{FPAT}---was +last assigned to. + @node Multiple Line @section Multiple-Line Records @@ -9700,7 +9710,7 @@ It then sends the list to the shell for execution. @c ENDOFRANGE reout @node Special Files -@section Special @value{FFN} in @command{gawk} +@section Special @value{FFN}s in @command{gawk} @c STARTOFRANGE gfn @cindex @command{gawk}, file names in @@ -11924,7 +11934,7 @@ made of characters and is therefore also a string. Thus, for example, the string constant @w{@code{" +3.14"}}, when it appears in program source code, is a string---even though it looks numeric---and -is @emph{never} treated as number for comparison +is @emph{never} treated as a number for comparison purposes. In short, when one operand is a ``pure'' string, such as a string @@ -29989,7 +29999,7 @@ to follow. @quotation Math class is tough! -@author Late 1980's Barbie +@author Teen Talk Barbie (July, 1992) @end quotation This @value{SECTION} provides a high level overview of the issues @@ -30615,7 +30625,7 @@ values. The default for @command{awk} is to use double-precision floating-point values. @item -In the 1980's, Barbie mistakenly said ``Math class is tough!'' +In the early 1990's, Barbie mistakenly said ``Math class is tough!'' While math isn't tough, floating-point arithmetic isn't the same as pencil and paper math, and care must be taken: diff --git a/doc/gawktexi.in b/doc/gawktexi.in index 22f9d410..aed8cbd7 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -6863,6 +6863,8 @@ shell, without any quotes, the @samp{\} gets deleted, so @command{awk} figures that you really want your fields to be separated with TABs and not @samp{t}s. Use @samp{-v FS="t"} or @samp{-F"[t]"} on the command line if you really do want to separate your fields with @samp{t}s. +Use @samp{-F '\t'} when not in compatibility mode to specify that TABs +separate fields. As an example, let's use an @command{awk} program file called @file{edu.awk} that contains the pattern @code{/edu/} and the action @samp{print $1}: @@ -7008,7 +7010,7 @@ root @noindent on an incorrect implementation of @command{awk}, while @command{gawk} -prints something like: +prints the full first line of the file, something like: @example root:nSijPlPhZZwgE:0:0:Root:/: @@ -7108,7 +7110,7 @@ haven't been introduced yet. BEGIN @{ FIELDWIDTHS = "9 6 10 6 7 7 35" @} NR > 2 @{ idle = $4 - sub(/^ */, "", idle) # strip leading spaces + sub(/^ +/, "", idle) # strip leading spaces if (idle == "") idle = 0 if (idle ~ /:/) @{ @@ -7266,6 +7268,8 @@ if (substr($i, 1, 1) == "\"") @{ As with @code{FS}, the @code{IGNORECASE} variable (@pxref{User-modified}) affects field splitting with @code{FPAT}. +Assigning a value to @code{FPAT} overrides field splitting +with @code{FS} and with @code{FIELDWIDTHS}. Similar to @code{FIELDWIDTHS}, the value of @code{PROCINFO["FS"]} will be @code{"FPAT"} if content-based field splitting is being used. @@ -7289,6 +7293,12 @@ FPAT = "([^,]*)|(\"[^\"]+\")" Finally, the @code{patsplit()} function makes the same functionality available for splitting regular strings (@pxref{String Functions}). +To recap, @command{gawk} provides three independent methods +to split input records into fields. @command{gawk} uses whichever +mechanism was last chosen based on which of the three +variables---@code{FS}, @code{FIELDWIDTHS}, and @code{FPAT}---was +last assigned to. + @node Multiple Line @section Multiple-Line Records @@ -9281,7 +9291,7 @@ It then sends the list to the shell for execution. @c ENDOFRANGE reout @node Special Files -@section Special @value{FFN} in @command{gawk} +@section Special @value{FFN}s in @command{gawk} @c STARTOFRANGE gfn @cindex @command{gawk}, file names in @@ -11275,7 +11285,7 @@ made of characters and is therefore also a string. Thus, for example, the string constant @w{@code{" +3.14"}}, when it appears in program source code, is a string---even though it looks numeric---and -is @emph{never} treated as number for comparison +is @emph{never} treated as a number for comparison purposes. In short, when one operand is a ``pure'' string, such as a string @@ -29104,7 +29114,7 @@ to follow. @quotation Math class is tough! -@author Late 1980's Barbie +@author Teen Talk Barbie (July, 1992) @end quotation This @value{SECTION} provides a high level overview of the issues @@ -29730,7 +29740,7 @@ values. The default for @command{awk} is to use double-precision floating-point values. @item -In the 1980's, Barbie mistakenly said ``Math class is tough!'' +In the early 1990's, Barbie mistakenly said ``Math class is tough!'' While math isn't tough, floating-point arithmetic isn't the same as pencil and paper math, and care must be taken: |