1INPLACE(3am) GNU Awk Extension Modules INPLACE(3am)
2
3
4
6 inplace - emulate sed/perl/ruby in-place editing
7
9 gawk -i inplace ...
10
12 The inplace extension adds two functions named inplace_begin() and
13 inplace_end(). These functions are meant to be invoked from the
14 inplace.awk wrapper which is installed when gawk is.
15
16 By default, each named file on the command line is replaced with a new
17 file of the same name whose contents are the results of running the AWK
18 program. If the user supplies an AWK variable named inplace::suffix in
19 a BEGIN rule or on the command line, then the inplace extension con‐
20 catenates that suffix onto the original filename and uses the result as
21 a filename for renaming the original.
22
23 For backwards compatibility, the variable will also check INPLACE_SUF‐
24 FIX (in the awk namespace) for the suffix to use if inplace::suffix is
25 not set.
26
27 One can disable inplace editing selectively by placing
28 inplace::enable=0 on the command line prior to files that should be
29 processed normally. One can reenable inplace editing by placing
30 inplace::enable=1 prior to files that should be subject to inplace
31 editing.
32
34 While the extension does attempt to preserve ownership and permissions,
35 it makes no attempt to copy the ACLs from the original file.
36
37 If the program dies prematurely, as might happen if an unhandled signal
38 is received, a temporary file may be left behind.
39
41 gawk -i inplace 'script' files ...
42 gawk -i inplace -f scriptfile files ...
43
45 GAWK: Effective AWK Programming, filefuncs(3am), fnmatch(3am),
46 fork(3am), ordchr(3am), readdir(3am), readfile(3am), revoutput(3am),
47 rwarray(3am).
48
50 Andrew Schorr, schorr@telemetry-investments.com.
51
53 Copyright © 2012, 2013, 2015, 2018, 2019, Free Software Foundation,
54 Inc.
55
56 Permission is granted to make and distribute verbatim copies of this
57 manual page provided the copyright notice and this permission notice
58 are preserved on all copies.
59
60 Permission is granted to copy and distribute modified versions of this
61 manual page under the conditions for verbatim copying, provided that
62 the entire resulting derived work is distributed under the terms of a
63 permission notice identical to this one.
64
65 Permission is granted to copy and distribute translations of this man‐
66 ual page into another language, under the above conditions for modified
67 versions, except that this permission notice may be stated in a trans‐
68 lation approved by the Foundation.
69
70
71
72Free Software Foundation Jun 26 2018 INPLACE(3am)