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: Aharon Robbins
Subject: Re: [bug-gawk] in-place edit request
Date: Sun, 23 Dec 2012 12:33:22 +0200
User-agent: Heirloom mailx 12.5 6/20/10

Hi Andy.

I'm not familiar with the perl select function. Can you describe what
it does?

It may be that in-place editing can be entirely implemented by using
BEGINFILE, ENDFILE, and a small extension function that simply uses
freopen(3) on stdout.

Since that has zero effect on the gawk code base, I'm all for it. :-)

Thanks,

Arnold

> Date: Sat, 22 Dec 2012 16:50:18 -0500
> From: "Andrew J. Schorr" <address@hidden>
> To: Ed Morton <address@hidden>
> Cc: address@hidden
> Subject: Re: [bug-gawk] in-place edit request
>
> 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]