man-pages/man3/inplace.3am.html
2021-03-31 01:06:50 +01:00

159 lines
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of INPLACE</TITLE>
</HEAD><BODY>
<H1>INPLACE</H1>
Section: GNU Awk Extension Modules (3am)<BR>Updated: Feb 02 2018<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
inplace - emulate sed/perl/ruby in-place editing
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
gawk -i inplace ...
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The
<I>inplace</I>
extension adds two functions named
<B>inplace_begin()</B>
and
<B>inplace_end()</B>.
These functions are meant to be invoked from the
<I>inplace.awk</I>
wrapper which is installed when
<I>gawk</I>
is.
<P>
By default, each named file on the command line is
replaced with a new file of the same name whose contents
are the results of running the AWK program.
If the user supplies an AWK variable named
<B>INPLACE_SUFFIX</B>
in a
<B>BEGIN</B>
rule or on the command line, then the
<I>inplace</I>
extension concatenates that suffix onto the original
filename and uses the result as a filename for renaming
the original.
<P>
One can disable inplace editing selectively by placing
<B>inplace=0</B>
on the command line prior to files that should be processed normally.
One can reenable inplace editing by placing
<B>inplace=1</B>
prior to files that should be subject to inplace editing.
<A NAME="lbAE">&nbsp;</A>
<H2>BUGS</H2>
While the extension does attempt to preserve ownership and permissions, it makes no attempt to copy the ACLs from the original file.
<P>
If the program dies prematurely, as might happen if an unhandled signal is received, a temporary file may be left behind.
<A NAME="lbAF">&nbsp;</A>
<H2>EXAMPLE</H2>
<PRE>
gawk -i inplace 'script' files ...
<BR>
gawk -i inplace -f scriptfile files ...
</PRE>
<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>
<I>GAWK: Effective AWK Programming</I>,
<I>filefuncs</I>(3am),
<I>fnmatch</I>(3am),
<I>fork</I>(3am),
<I>ordchr</I>(3am),
<I>readdir</I>(3am),
<I>readfile</I>(3am),
<I>revoutput</I>(3am),
<I>rwarray</I>(3am).
<A NAME="lbAH">&nbsp;</A>
<H2>AUTHOR</H2>
Andrew Schorr,
<B><A HREF="mailto:schorr@telemetry-investments.com">schorr@telemetry-investments.com</A></B>.
<A NAME="lbAI">&nbsp;</A>
<H2>COPYING PERMISSIONS</H2>
Copyright &#169; 2012, 2013, 2015, 2018,
Free Software Foundation, Inc.
<P>
Permission is granted to make and distribute verbatim copies of
this manual page provided the copyright notice and this permission
notice are preserved on all copies.
<P>
Permission is granted to copy and distribute modified versions of this
manual page under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
<P>
Permission is granted to copy and distribute translations of this
manual page into another language, under the above conditions for
modified versions, except that this permission notice may be stated in
a translation approved by the Foundation.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="4"><A HREF="#lbAE">BUGS</A><DD>
<DT id="5"><A HREF="#lbAF">EXAMPLE</A><DD>
<DT id="6"><A HREF="#lbAG">SEE ALSO</A><DD>
<DT id="7"><A HREF="#lbAH">AUTHOR</A><DD>
<DT id="8"><A HREF="#lbAI">COPYING PERMISSIONS</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:46 GMT, March 31, 2021
</BODY>
</HTML>