diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-01-09 14:47:51 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-01-09 14:47:51 +0200 |
commit | 81df0ef6c9ae780d1b4a9f784a611e9c8a07789f (patch) | |
tree | 689a4bbef261cf80b580438f1e7294060d7a9514 | |
parent | 1abfe5e82822a9e81a3bd1df2e7747afbc0ae1b9 (diff) | |
download | egawk-81df0ef6c9ae780d1b4a9f784a611e9c8a07789f.tar.gz egawk-81df0ef6c9ae780d1b4a9f784a611e9c8a07789f.tar.bz2 egawk-81df0ef6c9ae780d1b4a9f784a611e9c8a07789f.zip |
Minor edits to inplace extension doc.
-rw-r--r-- | awklib/eg/lib/inplace.awk | 10 | ||||
-rw-r--r-- | doc/ChangeLog | 4 | ||||
-rw-r--r-- | doc/gawk.info | 988 | ||||
-rw-r--r-- | doc/gawk.texi | 37 |
4 files changed, 524 insertions, 515 deletions
diff --git a/awklib/eg/lib/inplace.awk b/awklib/eg/lib/inplace.awk index a090d9e0..6403a228 100644 --- a/awklib/eg/lib/inplace.awk +++ b/awklib/eg/lib/inplace.awk @@ -2,13 +2,13 @@ @load "inplace" -# Please set INPLACE_SUFFIX to make a backup copy. For example, -# you may want to set INPLACE_SUFFIX to .bak on the command-line or in a -# BEGIN block. +# Please set INPLACE_SUFFIX to make a backup copy. For example, you may +# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. BEGINFILE { - inplace_begin(FILENAME, INPLACE_SUFFIX) + inplace_begin(FILENAME, INPLACE_SUFFIX) } + ENDFILE { - inplace_end(FILENAME, INPLACE_SUFFIX) + inplace_end(FILENAME, INPLACE_SUFFIX) } diff --git a/doc/ChangeLog b/doc/ChangeLog index 6f141ad6..2c31d9d4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2013-01-09 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi: Minor edits to documentation for new inplace extension. + 2013-01-08 Andrew J. Schorr <aschorr@telemetry-investments.com> * gawk.texi: Add documentation for new inplace extension. diff --git a/doc/gawk.info b/doc/gawk.info index 32971266..e8a85e8b 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -3528,7 +3528,7 @@ Class Meaning `[:upper:]' Uppercase alphabetic characters. `[:xdigit:]'Characters that are hexadecimal digits. -Table 3.1: POSIX Character Classes +Table 3.1: POSIX Character Classes For example, before the POSIX standard, you had to write `/[A-Za-z0-9]/' to match alphanumeric characters. If your character @@ -5516,7 +5516,7 @@ COMMAND `|& getline' Sets `$0' and `NF' Extension COMMAND `|& getline' Sets VAR Extension VAR -Table 4.1: `getline' Variants and What They Set +Table 4.1: `getline' Variants and What They Set File: gawk.info, Node: Read Timeout, Next: Command line directories, Prev: Getline, Up: Reading Files @@ -7184,7 +7184,7 @@ Feature Default `--posix' or `--use-lc-numeric' Input Use period Use locale `strtonum()'Use period Use locale -Table 6.1: Locale Decimal Point versus A Period +Table 6.1: Locale Decimal Point versus A Period Finally, modern day formal standards and IEEE standard floating point representation can have an unusual but important effect on the way @@ -7526,7 +7526,7 @@ LVALUE `%=' MODULUS Sets LVALUE to its remainder by MODULUS. LVALUE `^=' POWER LVALUE `**=' POWER Raises LVALUE to the power POWER. (c.e.) -Table 6.2: Arithmetic Assignment Operators +Table 6.2: Arithmetic Assignment Operators NOTE: Only the `^=' operator is specified by POSIX. For maximum portability, do not use the `**=' operator. @@ -7831,7 +7831,7 @@ X `!~' Y True if the string X does not match the regexp SUBSCRIPT `in' True if the array ARRAY has an element with the ARRAY subscript SUBSCRIPT. -Table 6.3: Relational Operators +Table 6.3: Relational Operators Comparison expressions have the value one if true and zero if false. When comparing operands of mixed types, numeric operands are converted @@ -11748,7 +11748,7 @@ is illustrated in *note table-sub-escapes::. `\\\\\\&' `\\\&' a literal `\\&' `\\q' `\q' a literal `\q' -Table 9.1: Historical Escape Sequence Processing for `sub()' and +Table 9.1: Historical Escape Sequence Processing for `sub()' and `gsub()' This table shows both the lexical-level processing, where an odd number @@ -11773,7 +11773,7 @@ literally. The interpretation of `\' and `&' then becomes as shown in `\\\\&' `\\&' a literal `\', then the matched text `\\\\\\&' `\\\&' a literal `\&' -Table 9.2: 1992 POSIX Rules for `sub()' and `gsub()' Escape Sequence +Table 9.2: 1992 POSIX Rules for `sub()' and `gsub()' Escape Sequence Processing This appears to solve the problem. Unfortunately, the phrasing of the @@ -11803,7 +11803,7 @@ table-sub-proposed::. `\\q' `\q' a literal `\q' `\\\\' `\\' `\\' -Table 9.3: Proposed Rules For `sub()' And Backslash +Table 9.3: Proposed Rules For `sub()' And Backslash In a nutshell, at the runtime level, there are now three special sequences of characters (`\\\&', `\\&' and `\&') whereas historically @@ -11830,7 +11830,7 @@ rules are presented in *note table-posix-sub::. `\\q' `\q' a literal `\q' `\\\\' `\\' `\' -Table 9.4: POSIX Rules For `sub()' And `gsub()' +Table 9.4: POSIX Rules For `sub()' And `gsub()' The only case where the difference is noticeable is the last one: `\\\\' is seen as `\\' and produces `\' instead of `\\'. @@ -11862,7 +11862,7 @@ the `\' does not, as shown in *note table-gensub-escapes::. `\\\\\\&' `\\\&' a literal `\&' `\\q' `\q' a literal `q' -Table 9.5: Escape Sequence Processing For `gensub()' +Table 9.5: Escape Sequence Processing For `gensub()' Because of the complexity of the lexical and runtime level processing and the special cases for `sub()' and `gsub()', we recommend the use of @@ -12421,7 +12421,7 @@ table-bitwise-ops::. 0 | 0 0 | 0 1 | 0 1 1 | 0 1 | 1 1 | 1 0 -Table 9.6: Bitwise Operations +Table 9.6: Bitwise Operations As you can see, the result of an AND operation is 1 only when _both_ bits are 1. The result of an OR operation is 1 if _either_ bit is 1. @@ -20865,7 +20865,7 @@ Single 32 24 -126 +127 Double 64 53 -1022 +1023 Quadruple 128 113 -16382 +16383 -Table 15.1: Basic IEEE Format Context Values +Table 15.1: Basic IEEE Format Context Values NOTE: The precision numbers include the implied leading one that gives them one extra bit of significand. @@ -20907,7 +20907,7 @@ Round toward zero `roundTowardZero' Round to nearest, ties away `roundTiesToAway' from zero -Table 15.2: IEEE 754 Rounding Modes +Table 15.2: IEEE 754 Rounding Modes The default mode `roundTiesToEven' is the most preferred, but the least intuitive. This method does the obvious thing for most values, by @@ -21139,10 +21139,10 @@ Round toward zero `roundTowardZero' `"Z"' or `"z"' Round to nearest, ties away `roundTiesToAway' `"A"' or `"a"' from zero -Table 15.3: `gawk' Rounding Modes +Table 15.3: `gawk' Rounding Modes `ROUNDMODE' has the default value `"N"', which selects the IEEE-754 -rounding mode `roundTiesToEven'. *note Table 15.3: +rounding mode `roundTiesToEven'. *note Table 15.3: table-gawk-rounding-modes, lists `"A"' to select the IEEE-754 mode `roundTiesToAway'. This is only available if your version of the MPFR library supports it; otherwise setting `ROUNDMODE' to this value has no @@ -21479,7 +21479,7 @@ fields are function pointers. This is shown in *note load-extension::. +-------+-+---+-+---+-+------------------+--------------------+ gawk Main Program Address Space Extension -Figure 16.1: Loading The Extension +Figure 16.1: Loading The Extension The extension can call functions inside `gawk' through these function pointers, at runtime, without needing (link-time) access to @@ -21499,7 +21499,7 @@ load-new-function::. +-------+-+---+-+---+-+------------------+--------------+-+---+ gawk Main Program Address Space Extension -Figure 16.2: Loading The New Function +Figure 16.2: Loading The New Function In the other direction, the extension registers its new functions with `gawk' by passing function pointers to the functions that provide @@ -21520,7 +21520,7 @@ calling convention. This is shown in *note call-new-function::. +-------+-+---+-+---+-+------------------+--------------+-+---+ gawk Main Program Address Space Extension -Figure 16.3: Calling The New Function +Figure 16.3: Calling The New Function The `do_XXX()' function, in turn, then uses the function pointers in the API `struct' to do its work, such as updating variables or arrays, @@ -21876,7 +21876,7 @@ Requested: Scalar Scalar Scalar false false Value false false false false Cookie -Table 16.1: Value Types Returned +Table 16.1: Value Types Returned File: gawk.info, Node: Constructor Functions, Next: Registration Functions, Prev: Requesting Values, Up: Extension API Description @@ -22511,7 +22511,7 @@ your extension function. They are: Fill in the `awk_value_t' structure pointed to by `result' with the `count''th argument. Return true if the actual type matches `wanted', false otherwise. In the latter case, `result->val_type' - indicates the actual type (*note Table 16.1: + indicates the actual type (*note Table 16.1: table-value-types-returned.). Counts are zero based--the first argument is numbered zero, the second one, and so on. `wanted' indicates the type of value expected. @@ -22557,7 +22557,7 @@ termed a "symbol table". regular C string. `wanted' indicates the type of value expected. Return true if the actual type matches `wanted', false otherwise In the latter case, `result->val_type' indicates the actual type - (*note Table 16.1: table-value-types-returned.). + (*note Table 16.1: table-value-types-returned.). `awk_bool_t sym_update(const char *name, awk_value_t *value);' Update the variable named by the string `name', which is a regular @@ -22892,7 +22892,7 @@ The following functions relate to individual array elements. value of the element whose index is `index'. `wanted' specifies the type of value you wish to retrieve. Return false if `wanted' does not match the actual type or if `index' is not in the array - (*note Table 16.1: table-value-types-returned.). + (*note Table 16.1: table-value-types-returned.). The value for `index' can be numeric, in which case `gawk' converts it to a string. Using non-integral values is possible, but @@ -24364,44 +24364,46 @@ File: gawk.info, Node: Extension Sample Inplace, Next: Extension Sample Ord, 16.6.4 Enabling in-place file editing. -------------------------------------- -The `inplace' extension emulates the `sed' `-i' option. It uses the -bundled `inplace.awk' include file to invoke the extension properly: +The `inplace' extension emulates the `sed' `-i' option which performs +"in placed" editing of each input file. It uses the bundled +`inplace.awk' include file to invoke the extension properly: # inplace --- load and invoke the inplace extension. @load "inplace" - # Please set INPLACE_SUFFIX to make a backup copy. For example, - # you may want to set INPLACE_SUFFIX to .bak on the command-line or in a - # BEGIN block. + # Please set INPLACE_SUFFIX to make a backup copy. For example, you may + # want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. BEGINFILE { - inplace_begin(FILENAME, INPLACE_SUFFIX) + inplace_begin(FILENAME, INPLACE_SUFFIX) } + ENDFILE { - inplace_end(FILENAME, INPLACE_SUFFIX) + inplace_end(FILENAME, INPLACE_SUFFIX) } For each regular file that is processed, the extension redirects -stdout to a temporary file configured to have the same owner and -permissions. After the file has been processed, stdout is restored to -its default destination. If `INPLACE_SUFFIX' is not an empty string, -the original file will be linked to a backup filename created by -appending that suffix. Finally, the temporary file is renamed to the -original filename. +standard output to a temporary file configured to have the same owner +and permissions as the original. After the file has been processed, +the extension restores standard output to its original destination. If +`INPLACE_SUFFIX' is not an empty string, the original file is linked to +a backup filename created by appending that suffix. Finally, the +temporary file is renamed to the original filename. - If any error is encountered, the extension issues a fatal error to -terminate processing immediately without damaging the original file. + If any error occurs, the extension issues a fatal error to terminate +processing immediately without damaging the original file. - Here are a couple of simple examples: + Here are some simple examples: - $ gawk -i inplace '{gsub(/foo/, "bar")} {print}' file1 file2 file3 + $ gawk -i inplace '{ gsub(/foo/, "bar") }; { print }' file1 file2 file3 To keep a backup copy of the original files, try this: - $ gawk -i inplace -vINPLACE_SUFFIX=.bak '{gsub(/foo/, "bar")} {print}' file1 file2 file3 + $ gawk -i inplace -v INPLACE_SUFFIX=.bak '{ gsub(/foo/, "bar") } + > { print }' file1 file2 file3 - It is left as an exercise to write a wrapper script that presents an + We leave it as an exercise to write a wrapper script that presents an interface similar to the `sed' `-i' option. @@ -31969,457 +31971,457 @@ Ref: Regexp Operators-Footnote-1159337 Ref: Regexp Operators-Footnote-2159484 Node: Bracket Expressions159582 Ref: table-char-classes161472 -Node: GNU Regexp Operators163998 -Node: Case-sensitivity167721 -Ref: Case-sensitivity-Footnote-1170689 -Ref: Case-sensitivity-Footnote-2170924 -Node: Leftmost Longest171032 -Node: Computed Regexps172233 -Node: Reading Files175643 -Node: Records177646 -Ref: Records-Footnote-1186570 -Node: Fields186607 -Ref: Fields-Footnote-1189640 -Node: Nonconstant Fields189726 -Node: Changing Fields191928 -Node: Field Separators197909 -Node: Default Field Splitting200538 -Node: Regexp Field Splitting201655 -Node: Single Character Fields204997 -Node: Command Line Field Separator206056 -Node: Field Splitting Summary209497 -Ref: Field Splitting Summary-Footnote-1212689 -Node: Constant Size212790 -Node: Splitting By Content217374 -Ref: Splitting By Content-Footnote-1221100 -Node: Multiple Line221140 -Ref: Multiple Line-Footnote-1226987 -Node: Getline227166 -Node: Plain Getline229382 -Node: Getline/Variable231471 -Node: Getline/File232612 -Node: Getline/Variable/File233934 -Ref: Getline/Variable/File-Footnote-1235533 -Node: Getline/Pipe235620 -Node: Getline/Variable/Pipe238180 -Node: Getline/Coprocess239287 -Node: Getline/Variable/Coprocess240530 -Node: Getline Notes241244 -Node: Getline Summary244031 -Ref: table-getline-variants244439 -Node: Read Timeout245300 -Ref: Read Timeout-Footnote-1249045 -Node: Command line directories249102 -Node: Printing249732 -Node: Print251363 -Node: Print Examples252700 -Node: Output Separators255484 -Node: OFMT257244 -Node: Printf258602 -Node: Basic Printf259508 -Node: Control Letters261047 -Node: Format Modifiers264859 -Node: Printf Examples270868 -Node: Redirection273583 -Node: Special Files280567 -Node: Special FD281100 -Ref: Special FD-Footnote-1284725 -Node: Special Network284799 -Node: Special Caveats285649 -Node: Close Files And Pipes286445 -Ref: Close Files And Pipes-Footnote-1293468 -Ref: Close Files And Pipes-Footnote-2293616 -Node: Expressions293766 -Node: Values294898 -Node: Constants295574 -Node: Scalar Constants296254 -Ref: Scalar Constants-Footnote-1297113 -Node: Nondecimal-numbers297295 -Node: Regexp Constants300354 -Node: Using Constant Regexps300829 -Node: Variables303884 -Node: Using Variables304539 -Node: Assignment Options306263 -Node: Conversion308135 -Ref: table-locale-affects313511 -Ref: Conversion-Footnote-1314138 -Node: All Operators314247 -Node: Arithmetic Ops314877 -Node: Concatenation317382 -Ref: Concatenation-Footnote-1320175 -Node: Assignment Ops320295 -Ref: table-assign-ops325283 -Node: Increment Ops326694 -Node: Truth Values and Conditions330164 -Node: Truth Values331247 -Node: Typing and Comparison332296 -Node: Variable Typing333085 -Ref: Variable Typing-Footnote-1336982 -Node: Comparison Operators337104 -Ref: table-relational-ops337514 -Node: POSIX String Comparison341066 -Ref: POSIX String Comparison-Footnote-1342022 -Node: Boolean Ops342160 -Ref: Boolean Ops-Footnote-1346238 -Node: Conditional Exp346329 -Node: Function Calls348061 -Node: Precedence351655 -Node: Locales355324 -Node: Patterns and Actions356413 -Node: Pattern Overview357467 -Node: Regexp Patterns359136 -Node: Expression Patterns359679 -Node: Ranges363364 -Node: BEGIN/END366330 -Node: Using BEGIN/END367092 -Ref: Using BEGIN/END-Footnote-1369823 -Node: I/O And BEGIN/END369929 -Node: BEGINFILE/ENDFILE372211 -Node: Empty375115 -Node: Using Shell Variables375431 -Node: Action Overview377716 -Node: Statements380073 -Node: If Statement381927 -Node: While Statement383426 -Node: Do Statement385470 -Node: For Statement386626 -Node: Switch Statement389778 -Node: Break Statement391875 -Node: Continue Statement393865 -Node: Next Statement395658 -Node: Nextfile Statement398048 -Node: Exit Statement400689 -Node: Built-in Variables403105 -Node: User-modified404200 -Ref: User-modified-Footnote-1412555 -Node: Auto-set412617 -Ref: Auto-set-Footnote-1424968 -Ref: Auto-set-Footnote-2425173 -Node: ARGC and ARGV425229 -Node: Arrays429080 -Node: Array Basics430585 -Node: Array Intro431411 -Node: Reference to Elements435729 -Node: Assigning Elements437999 -Node: Array Example438490 -Node: Scanning an Array440222 -Node: Controlling Scanning442536 -Ref: Controlling Scanning-Footnote-1447469 -Node: Delete447785 -Ref: Delete-Footnote-1450550 -Node: Numeric Array Subscripts450607 -Node: Uninitialized Subscripts452790 -Node: Multi-dimensional454418 -Node: Multi-scanning457512 -Node: Arrays of Arrays459103 -Node: Functions463748 -Node: Built-in464567 -Node: Calling Built-in465645 -Node: Numeric Functions467633 -Ref: Numeric Functions-Footnote-1471465 -Ref: Numeric Functions-Footnote-2471822 -Ref: Numeric Functions-Footnote-3471870 -Node: String Functions472139 -Ref: String Functions-Footnote-1495636 -Ref: String Functions-Footnote-2495765 -Ref: String Functions-Footnote-3496013 -Node: Gory Details496100 -Ref: table-sub-escapes497779 -Ref: table-sub-posix-92499136 -Ref: table-sub-proposed500490 -Ref: table-posix-sub501847 -Ref: table-gensub-escapes503395 -Ref: Gory Details-Footnote-1504605 -Ref: Gory Details-Footnote-2504656 -Node: I/O Functions504807 -Ref: I/O Functions-Footnote-1511912 -Node: Time Functions512059 -Ref: Time Functions-Footnote-1522992 -Ref: Time Functions-Footnote-2523060 -Ref: Time Functions-Footnote-3523218 -Ref: Time Functions-Footnote-4523329 -Ref: Time Functions-Footnote-5523441 -Ref: Time Functions-Footnote-6523668 -Node: Bitwise Functions523934 -Ref: table-bitwise-ops524492 -Ref: Bitwise Functions-Footnote-1528716 -Node: Type Functions528900 -Node: I18N Functions529370 -Node: User-defined530997 -Node: Definition Syntax531801 -Ref: Definition Syntax-Footnote-1536711 -Node: Function Example536780 -Node: Function Caveats539374 -Node: Calling A Function539795 -Node: Variable Scope540910 -Node: Pass By Value/Reference543873 -Node: Return Statement547313 -Node: Dynamic Typing550294 -Node: Indirect Calls551029 -Node: Library Functions560714 -Ref: Library Functions-Footnote-1564227 -Ref: Library Functions-Footnote-2564370 -Node: Library Names564541 -Ref: Library Names-Footnote-1568012 -Ref: Library Names-Footnote-2568232 -Node: General Functions568318 -Node: Strtonum Function569271 -Node: Assert Function572201 -Node: Round Function575527 -Node: Cliff Random Function577070 -Node: Ordinal Functions578086 -Ref: Ordinal Functions-Footnote-1581156 -Ref: Ordinal Functions-Footnote-2581408 -Node: Join Function581617 -Ref: Join Function-Footnote-1583388 -Node: Getlocaltime Function583588 -Node: Data File Management587303 -Node: Filetrans Function587935 -Node: Rewind Function592074 -Node: File Checking593461 -Node: Empty Files594555 -Node: Ignoring Assigns596785 -Node: Getopt Function598338 -Ref: Getopt Function-Footnote-1609642 -Node: Passwd Functions609845 -Ref: Passwd Functions-Footnote-1618820 -Node: Group Functions618908 -Node: Walking Arrays626992 -Node: Sample Programs628561 -Node: Running Examples629238 -Node: Clones629966 -Node: Cut Program631190 -Node: Egrep Program641035 -Ref: Egrep Program-Footnote-1648808 -Node: Id Program648918 -Node: Split Program652534 -Ref: Split Program-Footnote-1656053 -Node: Tee Program656181 -Node: Uniq Program658984 -Node: Wc Program666413 -Ref: Wc Program-Footnote-1670679 -Ref: Wc Program-Footnote-2670879 -Node: Miscellaneous Programs670971 -Node: Dupword Program672159 -Node: Alarm Program674190 -Node: Translate Program678939 -Ref: Translate Program-Footnote-1683326 -Ref: Translate Program-Footnote-2683554 -Node: Labels Program683688 -Ref: Labels Program-Footnote-1687059 -Node: Word Sorting687143 -Node: History Sorting691027 -Node: Extract Program692866 -Ref: Extract Program-Footnote-1700349 -Node: Simple Sed700477 -Node: Igawk Program703539 -Ref: Igawk Program-Footnote-1718696 -Ref: Igawk Program-Footnote-2718897 -Node: Anagram Program719035 -Node: Signature Program722103 -Node: Internationalization723203 -Node: I18N and L10N724635 -Node: Explaining gettext725321 -Ref: Explaining gettext-Footnote-1730387 -Ref: Explaining gettext-Footnote-2730571 -Node: Programmer i18n730736 -Node: Translator i18n734936 -Node: String Extraction735729 -Ref: String Extraction-Footnote-1736690 -Node: Printf Ordering736776 -Ref: Printf Ordering-Footnote-1739560 -Node: I18N Portability739624 -Ref: I18N Portability-Footnote-1742073 -Node: I18N Example742136 -Ref: I18N Example-Footnote-1744771 -Node: Gawk I18N744843 -Node: Advanced Features745460 -Node: Nondecimal Data746964 -Node: Array Sorting748547 -Node: Controlling Array Traversal749244 -Node: Array Sorting Functions757482 -Ref: Array Sorting Functions-Footnote-1761156 -Ref: Array Sorting Functions-Footnote-2761249 -Node: Two-way I/O761443 -Ref: Two-way I/O-Footnote-1766875 -Node: TCP/IP Networking766945 -Node: Profiling769789 -Node: Debugger777243 -Node: Debugging778211 -Node: Debugging Concepts778644 -Node: Debugging Terms780500 -Node: Awk Debugging783097 -Node: Sample Debugging Session783989 -Node: Debugger Invocation784509 -Node: Finding The Bug785838 -Node: List of Debugger Commands792326 -Node: Breakpoint Control793660 -Node: Debugger Execution Control797324 -Node: Viewing And Changing Data800684 -Node: Execution Stack804040 -Node: Debugger Info805507 -Node: Miscellaneous Debugger Commands809488 -Node: Readline Support814933 -Node: Limitations815764 -Node: Arbitrary Precision Arithmetic818016 -Ref: Arbitrary Precision Arithmetic-Footnote-1819658 -Node: General Arithmetic819806 -Node: Floating Point Issues821526 -Node: String Conversion Precision822407 -Ref: String Conversion Precision-Footnote-1824113 -Node: Unexpected Results824222 -Node: POSIX Floating Point Problems826375 -Ref: POSIX Floating Point Problems-Footnote-1830200 -Node: Integer Programming830238 -Node: Floating-point Programming831991 -Ref: Floating-point Programming-Footnote-1838300 -Node: Floating-point Representation838564 -Node: Floating-point Context839729 -Ref: table-ieee-formats840571 -Node: Rounding Mode841957 -Ref: table-rounding-modes842436 -Ref: Rounding Mode-Footnote-1845442 -Node: Gawk and MPFR845623 -Node: Arbitrary Precision Floats846865 -Ref: Arbitrary Precision Floats-Footnote-1849294 -Node: Setting Precision849605 -Node: Setting Rounding Mode852338 -Ref: table-gawk-rounding-modes852742 -Node: Floating-point Constants853926 -Node: Changing Precision855350 -Ref: Changing Precision-Footnote-1856750 -Node: Exact Arithmetic856924 -Node: Arbitrary Precision Integers860032 -Ref: Arbitrary Precision Integers-Footnote-1863032 -Node: Dynamic Extensions863179 -Node: Extension Intro864556 -Node: Plugin License865764 -Node: Extension Mechanism Outline866449 -Ref: load-extension866866 -Ref: load-new-function868346 -Ref: call-new-function869329 -Node: Extension API Description871325 -Node: Extension API Functions Introduction872664 -Node: General Data Types877442 -Ref: General Data Types-Footnote-1883044 -Node: Requesting Values883343 -Ref: table-value-types-returned884074 -Node: Constructor Functions885030 -Node: Registration Functions888026 -Node: Extension Functions888711 -Node: Exit Callback Functions890885 -Node: Extension Version String892128 -Node: Input Parsers892778 -Node: Output Wrappers902495 -Node: Two-way processors906911 -Node: Printing Messages909041 -Ref: Printing Messages-Footnote-1910118 -Node: Updating `ERRNO'910270 -Node: Accessing Parameters911009 -Node: Symbol Table Access912241 -Node: Symbol table by name912753 -Node: Symbol table by cookie914328 -Ref: Symbol table by cookie-Footnote-1918457 -Node: Cached values918520 -Ref: Cached values-Footnote-1921963 -Node: Array Manipulation922054 -Ref: Array Manipulation-Footnote-1923152 -Node: Array Data Types923191 -Ref: Array Data Types-Footnote-1925894 -Node: Array Functions925986 -Node: Flattening Arrays929754 -Node: Creating Arrays936593 -Node: Extension API Variables941388 -Node: Extension Versioning942024 -Node: Extension API Informational Variables943925 -Node: Extension API Boilerplate945011 -Node: Finding Extensions948842 -Node: Extension Example949389 -Node: Internal File Description950127 -Node: Internal File Ops953815 -Ref: Internal File Ops-Footnote-1965262 -Node: Using Internal File Ops965402 -Ref: Using Internal File Ops-Footnote-1967755 -Node: Extension Samples968021 -Node: Extension Sample File Functions969545 -Node: Extension Sample Fnmatch978018 -Node: Extension Sample Fork979744 -Node: Extension Sample Inplace980962 -Node: Extension Sample Ord982657 -Node: Extension Sample Readdir983436 -Node: Extension Sample Revout984940 -Node: Extension Sample Rev2way985533 -Node: Extension Sample Read write array986223 -Node: Extension Sample Readfile988106 -Node: Extension Sample API Tests988863 -Node: Extension Sample Time989388 -Node: gawkextlib990695 -Node: Language History993076 -Node: V7/SVR3.1994598 -Node: SVR4996919 -Node: POSIX998361 -Node: BTL999369 -Node: POSIX/GNU1000174 -Node: Common Extensions1005709 -Node: Ranges and Locales1006816 -Ref: Ranges and Locales-Footnote-11011434 -Ref: Ranges and Locales-Footnote-21011461 -Ref: Ranges and Locales-Footnote-31011721 -Node: Contributors1011942 -Node: Installation1016238 -Node: Gawk Distribution1017132 -Node: Getting1017616 -Node: Extracting1018442 -Node: Distribution contents1020134 -Node: Unix Installation1025395 -Node: Quick Installation1026012 -Node: Additional Configuration Options1027974 -Node: Configuration Philosophy1029451 -Node: Non-Unix Installation1031793 -Node: PC Installation1032251 -Node: PC Binary Installation1033550 -Node: PC Compiling1035398 -Node: PC Testing1038342 -Node: PC Using1039518 -Node: Cygwin1043703 -Node: MSYS1044703 -Node: VMS Installation1045217 -Node: VMS Compilation1045820 -Ref: VMS Compilation-Footnote-11046827 -Node: VMS Installation Details1046885 -Node: VMS Running1048520 -Node: VMS Old Gawk1050127 -Node: Bugs1050601 -Node: Other Versions1054453 -Node: Notes1060109 -Node: Compatibility Mode1060909 -Node: Additions1061692 -Node: Accessing The Source1062619 -Node: Adding Code1064222 -Node: New Ports1070264 -Node: Derived Files1074399 -Ref: Derived Files-Footnote-11079720 -Ref: Derived Files-Footnote-21079754 -Ref: Derived Files-Footnote-31080354 -Node: Future Extensions1080452 -Node: Implementation Limitations1081033 -Node: Extension Design1082285 -Node: Old Extension Problems1083434 -Ref: Old Extension Problems-Footnote-11084942 -Node: Extension New Mechanism Goals1084999 -Ref: Extension New Mechanism Goals-Footnote-11088358 -Node: Extension Other Design Decisions1088544 -Node: Extension Future Growth1090650 -Node: Old Extension Mechansim1091471 -Node: Basic Concepts1093228 -Node: Basic High Level1093909 -Ref: figure-general-flow1094180 -Ref: figure-process-flow1094779 -Ref: Basic High Level-Footnote-11098008 -Node: Basic Data Typing1098193 -Node: Glossary1101548 -Node: Copying1126859 -Node: GNU Free Documentation License1164416 -Node: Index1189553 +Node: GNU Regexp Operators163995 +Node: Case-sensitivity167718 +Ref: Case-sensitivity-Footnote-1170686 +Ref: Case-sensitivity-Footnote-2170921 +Node: Leftmost Longest171029 +Node: Computed Regexps172230 +Node: Reading Files175640 +Node: Records177643 +Ref: Records-Footnote-1186567 +Node: Fields186604 +Ref: Fields-Footnote-1189637 +Node: Nonconstant Fields189723 +Node: Changing Fields191925 +Node: Field Separators197906 +Node: Default Field Splitting200535 +Node: Regexp Field Splitting201652 +Node: Single Character Fields204994 +Node: Command Line Field Separator206053 +Node: Field Splitting Summary209494 +Ref: Field Splitting Summary-Footnote-1212686 +Node: Constant Size212787 +Node: Splitting By Content217371 +Ref: Splitting By Content-Footnote-1221097 +Node: Multiple Line221137 +Ref: Multiple Line-Footnote-1226984 +Node: Getline227163 +Node: Plain Getline229379 +Node: Getline/Variable231468 +Node: Getline/File232609 +Node: Getline/Variable/File233931 +Ref: Getline/Variable/File-Footnote-1235530 +Node: Getline/Pipe235617 +Node: Getline/Variable/Pipe238177 +Node: Getline/Coprocess239284 +Node: Getline/Variable/Coprocess240527 +Node: Getline Notes241241 +Node: Getline Summary244028 +Ref: table-getline-variants244436 +Node: Read Timeout245294 +Ref: Read Timeout-Footnote-1249039 +Node: Command line directories249096 +Node: Printing249726 +Node: Print251357 +Node: Print Examples252694 +Node: Output Separators255478 +Node: OFMT257238 +Node: Printf258596 +Node: Basic Printf259502 +Node: Control Letters261041 +Node: Format Modifiers264853 +Node: Printf Examples270862 +Node: Redirection273577 +Node: Special Files280561 +Node: Special FD281094 +Ref: Special FD-Footnote-1284719 +Node: Special Network284793 +Node: Special Caveats285643 +Node: Close Files And Pipes286439 +Ref: Close Files And Pipes-Footnote-1293462 +Ref: Close Files And Pipes-Footnote-2293610 +Node: Expressions293760 +Node: Values294892 +Node: Constants295568 +Node: Scalar Constants296248 +Ref: Scalar Constants-Footnote-1297107 +Node: Nondecimal-numbers297289 +Node: Regexp Constants300348 +Node: Using Constant Regexps300823 +Node: Variables303878 +Node: Using Variables304533 +Node: Assignment Options306257 +Node: Conversion308129 +Ref: table-locale-affects313505 +Ref: Conversion-Footnote-1314129 +Node: All Operators314238 +Node: Arithmetic Ops314868 +Node: Concatenation317373 +Ref: Concatenation-Footnote-1320166 +Node: Assignment Ops320286 +Ref: table-assign-ops325274 +Node: Increment Ops326682 +Node: Truth Values and Conditions330152 +Node: Truth Values331235 +Node: Typing and Comparison332284 +Node: Variable Typing333073 +Ref: Variable Typing-Footnote-1336970 +Node: Comparison Operators337092 +Ref: table-relational-ops337502 +Node: POSIX String Comparison341051 +Ref: POSIX String Comparison-Footnote-1342007 +Node: Boolean Ops342145 +Ref: Boolean Ops-Footnote-1346223 +Node: Conditional Exp346314 +Node: Function Calls348046 +Node: Precedence351640 +Node: Locales355309 +Node: Patterns and Actions356398 +Node: Pattern Overview357452 +Node: Regexp Patterns359121 +Node: Expression Patterns359664 +Node: Ranges363349 +Node: BEGIN/END366315 +Node: Using BEGIN/END367077 +Ref: Using BEGIN/END-Footnote-1369808 +Node: I/O And BEGIN/END369914 +Node: BEGINFILE/ENDFILE372196 +Node: Empty375100 +Node: Using Shell Variables375416 +Node: Action Overview377701 +Node: Statements380058 +Node: If Statement381912 +Node: While Statement383411 +Node: Do Statement385455 +Node: For Statement386611 +Node: Switch Statement389763 +Node: Break Statement391860 +Node: Continue Statement393850 +Node: Next Statement395643 +Node: Nextfile Statement398033 +Node: Exit Statement400674 +Node: Built-in Variables403090 +Node: User-modified404185 +Ref: User-modified-Footnote-1412540 +Node: Auto-set412602 +Ref: Auto-set-Footnote-1424953 +Ref: Auto-set-Footnote-2425158 +Node: ARGC and ARGV425214 +Node: Arrays429065 +Node: Array Basics430570 +Node: Array Intro431396 +Node: Reference to Elements435714 +Node: Assigning Elements437984 +Node: Array Example438475 +Node: Scanning an Array440207 +Node: Controlling Scanning442521 +Ref: Controlling Scanning-Footnote-1447454 +Node: Delete447770 +Ref: Delete-Footnote-1450535 +Node: Numeric Array Subscripts450592 +Node: Uninitialized Subscripts452775 +Node: Multi-dimensional454403 +Node: Multi-scanning457497 +Node: Arrays of Arrays459088 +Node: Functions463733 +Node: Built-in464552 +Node: Calling Built-in465630 +Node: Numeric Functions467618 +Ref: Numeric Functions-Footnote-1471450 +Ref: Numeric Functions-Footnote-2471807 +Ref: Numeric Functions-Footnote-3471855 +Node: String Functions472124 +Ref: String Functions-Footnote-1495621 +Ref: String Functions-Footnote-2495750 +Ref: String Functions-Footnote-3495998 +Node: Gory Details496085 +Ref: table-sub-escapes497764 +Ref: table-sub-posix-92499118 +Ref: table-sub-proposed500469 +Ref: table-posix-sub501823 +Ref: table-gensub-escapes503368 +Ref: Gory Details-Footnote-1504575 +Ref: Gory Details-Footnote-2504626 +Node: I/O Functions504777 +Ref: I/O Functions-Footnote-1511882 +Node: Time Functions512029 +Ref: Time Functions-Footnote-1522962 +Ref: Time Functions-Footnote-2523030 +Ref: Time Functions-Footnote-3523188 +Ref: Time Functions-Footnote-4523299 +Ref: Time Functions-Footnote-5523411 +Ref: Time Functions-Footnote-6523638 +Node: Bitwise Functions523904 +Ref: table-bitwise-ops524462 +Ref: Bitwise Functions-Footnote-1528683 +Node: Type Functions528867 +Node: I18N Functions529337 +Node: User-defined530964 +Node: Definition Syntax531768 +Ref: Definition Syntax-Footnote-1536678 +Node: Function Example536747 +Node: Function Caveats539341 +Node: Calling A Function539762 +Node: Variable Scope540877 +Node: Pass By Value/Reference543840 +Node: Return Statement547280 +Node: Dynamic Typing550261 +Node: Indirect Calls550996 +Node: Library Functions560681 +Ref: Library Functions-Footnote-1564194 +Ref: Library Functions-Footnote-2564337 +Node: Library Names564508 +Ref: Library Names-Footnote-1567979 +Ref: Library Names-Footnote-2568199 +Node: General Functions568285 +Node: Strtonum Function569238 +Node: Assert Function572168 +Node: Round Function575494 +Node: Cliff Random Function577037 +Node: Ordinal Functions578053 +Ref: Ordinal Functions-Footnote-1581123 +Ref: Ordinal Functions-Footnote-2581375 +Node: Join Function581584 +Ref: Join Function-Footnote-1583355 +Node: Getlocaltime Function583555 +Node: Data File Management587270 +Node: Filetrans Function587902 +Node: Rewind Function592041 +Node: File Checking593428 +Node: Empty Files594522 +Node: Ignoring Assigns596752 +Node: Getopt Function598305 +Ref: Getopt Function-Footnote-1609609 +Node: Passwd Functions609812 +Ref: Passwd Functions-Footnote-1618787 +Node: Group Functions618875 +Node: Walking Arrays626959 +Node: Sample Programs628528 +Node: Running Examples629205 +Node: Clones629933 +Node: Cut Program631157 +Node: Egrep Program641002 +Ref: Egrep Program-Footnote-1648775 +Node: Id Program648885 +Node: Split Program652501 +Ref: Split Program-Footnote-1656020 +Node: Tee Program656148 +Node: Uniq Program658951 +Node: Wc Program666380 +Ref: Wc Program-Footnote-1670646 +Ref: Wc Program-Footnote-2670846 +Node: Miscellaneous Programs670938 +Node: Dupword Program672126 +Node: Alarm Program674157 +Node: Translate Program678906 +Ref: Translate Program-Footnote-1683293 +Ref: Translate Program-Footnote-2683521 +Node: Labels Program683655 +Ref: Labels Program-Footnote-1687026 +Node: Word Sorting687110 +Node: History Sorting690994 +Node: Extract Program692833 +Ref: Extract Program-Footnote-1700316 +Node: Simple Sed700444 +Node: Igawk Program703506 +Ref: Igawk Program-Footnote-1718663 +Ref: Igawk Program-Footnote-2718864 +Node: Anagram Program719002 +Node: Signature Program722070 +Node: Internationalization723170 +Node: I18N and L10N724602 +Node: Explaining gettext725288 +Ref: Explaining gettext-Footnote-1730354 +Ref: Explaining gettext-Footnote-2730538 +Node: Programmer i18n730703 +Node: Translator i18n734903 +Node: String Extraction735696 +Ref: String Extraction-Footnote-1736657 +Node: Printf Ordering736743 +Ref: Printf Ordering-Footnote-1739527 +Node: I18N Portability739591 +Ref: I18N Portability-Footnote-1742040 +Node: I18N Example742103 +Ref: I18N Example-Footnote-1744738 +Node: Gawk I18N744810 +Node: Advanced Features745427 +Node: Nondecimal Data746931 +Node: Array Sorting748514 +Node: Controlling Array Traversal749211 +Node: Array Sorting Functions757449 +Ref: Array Sorting Functions-Footnote-1761123 +Ref: Array Sorting Functions-Footnote-2761216 +Node: Two-way I/O761410 +Ref: Two-way I/O-Footnote-1766842 +Node: TCP/IP Networking766912 +Node: Profiling769756 +Node: Debugger777210 +Node: Debugging778178 +Node: Debugging Concepts778611 +Node: Debugging Terms780467 +Node: Awk Debugging783064 +Node: Sample Debugging Session783956 +Node: Debugger Invocation784476 +Node: Finding The Bug785805 +Node: List of Debugger Commands792293 +Node: Breakpoint Control793627 +Node: Debugger Execution Control797291 +Node: Viewing And Changing Data800651 +Node: Execution Stack804007 +Node: Debugger Info805474 +Node: Miscellaneous Debugger Commands809455 +Node: Readline Support814900 +Node: Limitations815731 +Node: Arbitrary Precision Arithmetic817983 +Ref: Arbitrary Precision Arithmetic-Footnote-1819625 +Node: General Arithmetic819773 +Node: Floating Point Issues821493 +Node: String Conversion Precision822374 +Ref: String Conversion Precision-Footnote-1824080 +Node: Unexpected Results824189 +Node: POSIX Floating Point Problems826342 +Ref: POSIX Floating Point Problems-Footnote-1830167 +Node: Integer Programming830205 +Node: Floating-point Programming831958 +Ref: Floating-point Programming-Footnote-1838267 +Node: Floating-point Representation838531 +Node: Floating-point Context839696 +Ref: table-ieee-formats840538 +Node: Rounding Mode841922 +Ref: table-rounding-modes842401 +Ref: Rounding Mode-Footnote-1845405 +Node: Gawk and MPFR845586 +Node: Arbitrary Precision Floats846828 +Ref: Arbitrary Precision Floats-Footnote-1849257 +Node: Setting Precision849568 +Node: Setting Rounding Mode852301 +Ref: table-gawk-rounding-modes852705 +Node: Floating-point Constants853885 +Node: Changing Precision855309 +Ref: Changing Precision-Footnote-1856709 +Node: Exact Arithmetic856883 +Node: Arbitrary Precision Integers859991 +Ref: Arbitrary Precision Integers-Footnote-1862991 +Node: Dynamic Extensions863138 +Node: Extension Intro864515 +Node: Plugin License865723 +Node: Extension Mechanism Outline866408 +Ref: load-extension866825 +Ref: load-new-function868303 +Ref: call-new-function869284 +Node: Extension API Description871278 +Node: Extension API Functions Introduction872617 +Node: General Data Types877395 +Ref: General Data Types-Footnote-1882997 +Node: Requesting Values883296 +Ref: table-value-types-returned884027 +Node: Constructor Functions884981 +Node: Registration Functions887977 +Node: Extension Functions888662 +Node: Exit Callback Functions890836 +Node: Extension Version String892079 +Node: Input Parsers892729 +Node: Output Wrappers902446 +Node: Two-way processors906862 +Node: Printing Messages908992 +Ref: Printing Messages-Footnote-1910069 +Node: Updating `ERRNO'910221 +Node: Accessing Parameters910960 +Node: Symbol Table Access912190 +Node: Symbol table by name912702 +Node: Symbol table by cookie914275 +Ref: Symbol table by cookie-Footnote-1918404 +Node: Cached values918467 +Ref: Cached values-Footnote-1921910 +Node: Array Manipulation922001 +Ref: Array Manipulation-Footnote-1923099 +Node: Array Data Types923138 +Ref: Array Data Types-Footnote-1925841 +Node: Array Functions925933 +Node: Flattening Arrays929699 +Node: Creating Arrays936538 +Node: Extension API Variables941333 +Node: Extension Versioning941969 +Node: Extension API Informational Variables943870 +Node: Extension API Boilerplate944956 +Node: Finding Extensions948787 +Node: Extension Example949334 +Node: Internal File Description950072 +Node: Internal File Ops953760 +Ref: Internal File Ops-Footnote-1965207 +Node: Using Internal File Ops965347 +Ref: Using Internal File Ops-Footnote-1967700 +Node: Extension Samples967966 +Node: Extension Sample File Functions969490 +Node: Extension Sample Fnmatch977963 +Node: Extension Sample Fork979689 +Node: Extension Sample Inplace980907 +Node: Extension Sample Ord982699 +Node: Extension Sample Readdir983478 +Node: Extension Sample Revout984982 +Node: Extension Sample Rev2way985575 +Node: Extension Sample Read write array986265 +Node: Extension Sample Readfile988148 +Node: Extension Sample API Tests988905 +Node: Extension Sample Time989430 +Node: gawkextlib990737 +Node: Language History993118 +Node: V7/SVR3.1994640 +Node: SVR4996961 +Node: POSIX998403 +Node: BTL999411 +Node: POSIX/GNU1000216 +Node: Common Extensions1005751 +Node: Ranges and Locales1006858 +Ref: Ranges and Locales-Footnote-11011476 +Ref: Ranges and Locales-Footnote-21011503 +Ref: Ranges and Locales-Footnote-31011763 +Node: Contributors1011984 +Node: Installation1016280 +Node: Gawk Distribution1017174 +Node: Getting1017658 +Node: Extracting1018484 +Node: Distribution contents1020176 +Node: Unix Installation1025437 +Node: Quick Installation1026054 +Node: Additional Configuration Options1028016 +Node: Configuration Philosophy1029493 +Node: Non-Unix Installation1031835 +Node: PC Installation1032293 +Node: PC Binary Installation1033592 +Node: PC Compiling1035440 +Node: PC Testing1038384 +Node: PC Using1039560 +Node: Cygwin1043745 +Node: MSYS1044745 +Node: VMS Installation1045259 +Node: VMS Compilation1045862 +Ref: VMS Compilation-Footnote-11046869 +Node: VMS Installation Details1046927 +Node: VMS Running1048562 +Node: VMS Old Gawk1050169 +Node: Bugs1050643 +Node: Other Versions1054495 +Node: Notes1060151 +Node: Compatibility Mode1060951 +Node: Additions1061734 +Node: Accessing The Source1062661 +Node: Adding Code1064264 +Node: New Ports1070306 +Node: Derived Files1074441 +Ref: Derived Files-Footnote-11079762 +Ref: Derived Files-Footnote-21079796 +Ref: Derived Files-Footnote-31080396 +Node: Future Extensions1080494 +Node: Implementation Limitations1081075 +Node: Extension Design1082327 +Node: Old Extension Problems1083476 +Ref: Old Extension Problems-Footnote-11084984 +Node: Extension New Mechanism Goals1085041 +Ref: Extension New Mechanism Goals-Footnote-11088400 +Node: Extension Other Design Decisions1088586 +Node: Extension Future Growth1090692 +Node: Old Extension Mechansim1091513 +Node: Basic Concepts1093270 +Node: Basic High Level1093951 +Ref: figure-general-flow1094222 +Ref: figure-process-flow1094821 +Ref: Basic High Level-Footnote-11098050 +Node: Basic Data Typing1098235 +Node: Glossary1101590 +Node: Copying1126901 +Node: GNU Free Documentation License1164458 +Node: Index1189595 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 6f44c969..f728b3fd 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -31509,7 +31509,8 @@ else @node Extension Sample Inplace @subsection Enabling in-place file editing. -The @code{inplace} extension emulates the @command{sed} @option{-i} option. +The @code{inplace} extension emulates the @command{sed} @option{-i} option +which performs ``in placed'' editing of each input file. It uses the bundled @file{inplace.awk} include file to invoke the extension properly: @@ -31520,43 +31521,45 @@ properly: @@load "inplace" -# Please set INPLACE_SUFFIX to make a backup copy. For example, -# you may want to set INPLACE_SUFFIX to .bak on the command-line or in a -# BEGIN block. +# Please set INPLACE_SUFFIX to make a backup copy. For example, you may +# want to set INPLACE_SUFFIX to .bak on the command line or in a BEGIN rule. BEGINFILE @{ - inplace_begin(FILENAME, INPLACE_SUFFIX) + inplace_begin(FILENAME, INPLACE_SUFFIX) @} + ENDFILE @{ - inplace_end(FILENAME, INPLACE_SUFFIX) + inplace_end(FILENAME, INPLACE_SUFFIX) @} @end group @c endfile @end example -For each regular file that is processed, the extension redirects stdout -to a temporary file configured to have the same owner and permissions. -After the file has been processed, stdout is restored to its default -destination. If @code{INPLACE_SUFFIX} is not an empty string, the -original file will be linked to a backup filename created by appending -that suffix. Finally, the temporary file is renamed to the original filename. +For each regular file that is processed, the extension redirects +standard output to a temporary file configured to have the same owner +and permissions as the original. After the file has been processed, +the extension restores standard output to its original destination. +If @code{INPLACE_SUFFIX} is not an empty string, the original file is +linked to a backup filename created by appending that suffix. Finally, +the temporary file is renamed to the original filename. -If any error is encountered, the extension issues a fatal error to terminate +If any error occurs, the extension issues a fatal error to terminate processing immediately without damaging the original file. -Here are a couple of simple examples: +Here are some simple examples: @example -$ @kbd{gawk -i inplace '@{gsub(/foo/, "bar")@} @{print@}' file1 file2 file3} +$ @kbd{gawk -i inplace '@{ gsub(/foo/, "bar") @}; @{ print @}' file1 file2 file3} @end example To keep a backup copy of the original files, try this: @example -$ @kbd{gawk -i inplace -vINPLACE_SUFFIX=.bak '@{gsub(/foo/, "bar")@} @{print@}' file1 file2 file3} +$ @kbd{gawk -i inplace -v INPLACE_SUFFIX=.bak '@{ gsub(/foo/, "bar") @}} +> @kbd{@{ print @}' file1 file2 file3} @end example -It is left as an exercise to write a wrapper script that presents an +We leave it as an exercise to write a wrapper script that presents an interface similar to the @command{sed} @option{-i} option. @node Extension Sample Ord |