aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.info
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawk.info')
-rw-r--r--doc/gawk.info205
1 files changed, 116 insertions, 89 deletions
diff --git a/doc/gawk.info b/doc/gawk.info
index 53e11012..6d6def4f 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -25937,17 +25937,31 @@ The 'inplace' extension emulates GNU 'sed''s '-i' option, which performs
# 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.
+ # By default, each filename on the command line will be edited inplace.
+ # But you can selectively disable this by adding an inplace=0 argument
+ # prior to files that you do not want to process this way. You can then
+ # reenable it later on the commandline by putting inplace=1 before files
+ # that you wish to be subject to inplace editing.
+
# N.B. We call inplace_end() in the BEGINFILE and END rules so that any
# actions in an ENDFILE rule will be redirected as expected.
+ BEGIN {
+ inplace = 1 # enabled by default
+ }
+
BEGINFILE {
if (_inplace_filename != "")
inplace_end(_inplace_filename, INPLACE_SUFFIX)
- inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ if (inplace)
+ inplace_begin(_inplace_filename = FILENAME, INPLACE_SUFFIX)
+ else
+ _inplace_filename = ""
}
END {
- inplace_end(FILENAME, INPLACE_SUFFIX)
+ if (_inplace_filename != "")
+ inplace_end(_inplace_filename, INPLACE_SUFFIX)
}
For each regular file that is processed, the extension redirects
@@ -25958,6 +25972,12 @@ extension restores standard output to its original destination. If
a backup file name created by appending that suffix. Finally, the
temporary file is renamed to the original file name.
+ Note that the use of this feature can be controlled by placing
+'inplace=0' on the command-line prior to listing files that should not
+be processed this way. You can reenable inplace editing by adding an
+'inplace=1' argument prior to files that should be subject to inplace
+editing.
+
The '_inplace_filename' variable serves to keep track of the current
filename so as to not invoke 'inplace_end()' before processing the first
file.
@@ -25974,6 +25994,13 @@ processing immediately without damaging the original file.
$ gawk -i inplace -v INPLACE_SUFFIX=.bak '{ gsub(/foo/, "bar") }
> { print }' file1 file2 file3
+ Please note that, while the extension does attempt to preserve
+ownership and permissions, it makes no attempt to copy the ACLs from the
+original file.
+
+ If the program dies prematurely, as might happen if an unhandled
+signal is received, a temporary file may be left behind.
+

File: gawk.info, Node: Extension Sample Ord, Next: Extension Sample Readdir, Prev: Extension Sample Inplace, Up: Extension Samples
@@ -35432,92 +35459,92 @@ Node: Extension Sample File Functions1039747
Node: Extension Sample Fnmatch1047396
Node: Extension Sample Fork1048883
Node: Extension Sample Inplace1050101
-Node: Extension Sample Ord1052187
-Node: Extension Sample Readdir1053023
-Ref: table-readdir-file-types1053912
-Node: Extension Sample Revout1054717
-Node: Extension Sample Rev2way1055306
-Node: Extension Sample Read write array1056046
-Node: Extension Sample Readfile1057988
-Node: Extension Sample Time1059083
-Node: Extension Sample API Tests1060431
-Node: gawkextlib1060923
-Node: Extension summary1063370
-Node: Extension Exercises1067062
-Node: Language History1068559
-Node: V7/SVR3.11070215
-Node: SVR41072368
-Node: POSIX1073802
-Node: BTL1075182
-Node: POSIX/GNU1075912
-Node: Feature History1081751
-Node: Common Extensions1096070
-Node: Ranges and Locales1097353
-Ref: Ranges and Locales-Footnote-11101969
-Ref: Ranges and Locales-Footnote-21101996
-Ref: Ranges and Locales-Footnote-31102231
-Node: Contributors1102452
-Node: History summary1108021
-Node: Installation1109401
-Node: Gawk Distribution1110346
-Node: Getting1110830
-Node: Extracting1111653
-Node: Distribution contents1113291
-Node: Unix Installation1119387
-Node: Quick Installation1120069
-Node: Shell Startup Files1122483
-Node: Additional Configuration Options1123561
-Node: Configuration Philosophy1125366
-Node: Non-Unix Installation1127736
-Node: PC Installation1128194
-Node: PC Binary Installation1129514
-Node: PC Compiling1131366
-Ref: PC Compiling-Footnote-11134390
-Node: PC Testing1134499
-Node: PC Using1135679
-Node: Cygwin1139793
-Node: MSYS1140563
-Node: VMS Installation1141064
-Node: VMS Compilation1141855
-Ref: VMS Compilation-Footnote-11143085
-Node: VMS Dynamic Extensions1143143
-Node: VMS Installation Details1144828
-Node: VMS Running1147081
-Node: VMS GNV1149922
-Node: VMS Old Gawk1150657
-Node: Bugs1151128
-Node: Other Versions1155242
-Node: Installation summary1161716
-Node: Notes1162774
-Node: Compatibility Mode1163639
-Node: Additions1164421
-Node: Accessing The Source1165346
-Node: Adding Code1166782
-Node: New Ports1172937
-Node: Derived Files1177425
-Ref: Derived Files-Footnote-11182910
-Ref: Derived Files-Footnote-21182945
-Ref: Derived Files-Footnote-31183543
-Node: Future Extensions1183657
-Node: Implementation Limitations1184315
-Node: Extension Design1185498
-Node: Old Extension Problems1186652
-Ref: Old Extension Problems-Footnote-11188170
-Node: Extension New Mechanism Goals1188227
-Ref: Extension New Mechanism Goals-Footnote-11191591
-Node: Extension Other Design Decisions1191780
-Node: Extension Future Growth1193893
-Node: Old Extension Mechanism1194729
-Node: Notes summary1196492
-Node: Basic Concepts1197674
-Node: Basic High Level1198355
-Ref: figure-general-flow1198637
-Ref: figure-process-flow1199322
-Ref: Basic High Level-Footnote-11202623
-Node: Basic Data Typing1202808
-Node: Glossary1206136
-Node: Copying1238082
-Node: GNU Free Documentation License1275621
-Node: Index1300739
+Node: Extension Sample Ord1053311
+Node: Extension Sample Readdir1054147
+Ref: table-readdir-file-types1055036
+Node: Extension Sample Revout1055841
+Node: Extension Sample Rev2way1056430
+Node: Extension Sample Read write array1057170
+Node: Extension Sample Readfile1059112
+Node: Extension Sample Time1060207
+Node: Extension Sample API Tests1061555
+Node: gawkextlib1062047
+Node: Extension summary1064494
+Node: Extension Exercises1068186
+Node: Language History1069683
+Node: V7/SVR3.11071339
+Node: SVR41073492
+Node: POSIX1074926
+Node: BTL1076306
+Node: POSIX/GNU1077036
+Node: Feature History1082875
+Node: Common Extensions1097194
+Node: Ranges and Locales1098477
+Ref: Ranges and Locales-Footnote-11103093
+Ref: Ranges and Locales-Footnote-21103120
+Ref: Ranges and Locales-Footnote-31103355
+Node: Contributors1103576
+Node: History summary1109145
+Node: Installation1110525
+Node: Gawk Distribution1111470
+Node: Getting1111954
+Node: Extracting1112777
+Node: Distribution contents1114415
+Node: Unix Installation1120511
+Node: Quick Installation1121193
+Node: Shell Startup Files1123607
+Node: Additional Configuration Options1124685
+Node: Configuration Philosophy1126490
+Node: Non-Unix Installation1128860
+Node: PC Installation1129318
+Node: PC Binary Installation1130638
+Node: PC Compiling1132490
+Ref: PC Compiling-Footnote-11135514
+Node: PC Testing1135623
+Node: PC Using1136803
+Node: Cygwin1140917
+Node: MSYS1141687
+Node: VMS Installation1142188
+Node: VMS Compilation1142979
+Ref: VMS Compilation-Footnote-11144209
+Node: VMS Dynamic Extensions1144267
+Node: VMS Installation Details1145952
+Node: VMS Running1148205
+Node: VMS GNV1151046
+Node: VMS Old Gawk1151781
+Node: Bugs1152252
+Node: Other Versions1156366
+Node: Installation summary1162840
+Node: Notes1163898
+Node: Compatibility Mode1164763
+Node: Additions1165545
+Node: Accessing The Source1166470
+Node: Adding Code1167906
+Node: New Ports1174061
+Node: Derived Files1178549
+Ref: Derived Files-Footnote-11184034
+Ref: Derived Files-Footnote-21184069
+Ref: Derived Files-Footnote-31184667
+Node: Future Extensions1184781
+Node: Implementation Limitations1185439
+Node: Extension Design1186622
+Node: Old Extension Problems1187776
+Ref: Old Extension Problems-Footnote-11189294
+Node: Extension New Mechanism Goals1189351
+Ref: Extension New Mechanism Goals-Footnote-11192715
+Node: Extension Other Design Decisions1192904
+Node: Extension Future Growth1195017
+Node: Old Extension Mechanism1195853
+Node: Notes summary1197616
+Node: Basic Concepts1198798
+Node: Basic High Level1199479
+Ref: figure-general-flow1199761
+Ref: figure-process-flow1200446
+Ref: Basic High Level-Footnote-11203747
+Node: Basic Data Typing1203932
+Node: Glossary1207260
+Node: Copying1239206
+Node: GNU Free Documentation License1276745
+Node: Index1301863

End Tag Table