[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] -i infile unexpected behavior
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] -i infile unexpected behavior |
Date: |
Sun, 15 Mar 2015 18:38:55 -0400 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi Ed,
On Sun, Mar 15, 2015 at 12:35:09PM -0500, Ed Morton wrote:
> >On 3/15/2015 11:26 AM, Andrew J. Schorr wrote:
> >>The "inplace" include file contains an ENDFILE rule that terminates the
> >>inplace processing. Consider an alternative approach: bash-4.2$ awk
> >>'ENDFILE {print "bar"}; @include "inplace"' file bash-4.2$ cat file bar
> >>bash-4.2$ This includes the "inplace" ENDFILE rule after yours, so that
> >>the print occurs before the "inplace" processing is terminated. In other
> >>words, the ordering of the ENDFILE rules matters.
> Could you move the code that terminates the inplace processing from the
> ENDFILE to a BEGINFILE rule?
You're certainly free to replace inplace.awk with your own version.
For example, you could try:
@load "inplace"
BEGINFILE {
if (INPLACE_FILENAME)
inplace_end(INPLACE_FILENAME, INPLACE_SUFFIX)
inplace_begin(FILENAME, INPLACE_SUFFIX)
INPLACE_FILENAME = FILENAME
}
END {
inplace_end(FILENAME, INPLACE_SUFFIX)
}
I haven't tested this, but maybe it would behave more sensibly. If you give it
a try, please report back on your results.
Regards,
Andy
- [bug-gawk] -i infile unexpected behavior, Ed Morton, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior, Andrew J. Schorr, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior, Ed Morton, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior,
Andrew J. Schorr <=
- Re: [bug-gawk] -i infile unexpected behavior, Ed Morton, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior, Andrew J. Schorr, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior, Ed Morton, 2015/03/15
- Re: [bug-gawk] -i infile unexpected behavior, arnold, 2015/03/16
- Re: [bug-gawk] -i infile unexpected behavior, Andrew J. Schorr, 2015/03/17
- Re: [bug-gawk] -i infile unexpected behavior, Andrew J. Schorr, 2015/03/17
- Re: [bug-gawk] -i infile unexpected behavior, Andrew J. Schorr, 2015/03/15