bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] in-place edit request


From: Andrew J. Schorr
Subject: Re: [bug-gawk] in-place edit request
Date: Sat, 22 Dec 2012 16:50:18 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Thu, Dec 20, 2012 at 05:12:48PM -0600, Ed Morton wrote:
> Can we get an in-place edit function for gawk like sed, perl, ruby.,
> etc. have with their "-i" option? It should behave like perl does.
> See the discussion at
> https://groups.google.com/forum/#!topic/comp.lang.awk/ORwDyRRBcHE.

>From the description of the -i option in the perl man page, my guess is that
something similar could be implemented using a gawk include file (using
BEGINFILE and ENDFILE rules) if gawk had the ability to select a default
destination for print and printf statements using something like the perl
"select" function.  So I think the real question may be whether it is a good
idea to add the equivalent of the perl "select" function to awk.  Am I missing
anything?  It looks like the gawk source already has an output_fp variable that
defaults to stdout, so it appears that it might not be too hard to implement
this feature.  The debugger already uses the "outfile" option to change this
setting.

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]