Deutsch   English   Français   Italiano  
<100pvgc$44pv$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
Newsgroups: comp.lang.awk
Subject: Re: GNU Awk - inplace editing
Date: Fri, 23 May 2025 16:08:10 +0200
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <100pvgc$44pv$1@dont-email.me>
References: <100p11m$3uh3m$1@dont-email.me>
 <100pb7d$3kkjb$1@news.xmission.com> <20250523015528.637@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 23 May 2025 16:08:13 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5879c210c8b875af6b242e8502084993";
	logging-data="135999"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+CmvyNQomdk6cUP01LDSUn"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
Cancel-Lock: sha1:AlBcByavV1xqPLn8E77kUReQ58U=
In-Reply-To: <20250523015528.637@kylheku.com>
X-Enigmail-Draft-Status: N1110

On 23.05.2025 10:58, Kaz Kylheku wrote:
> On 2025-05-23, Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> In article <100p11m$3uh3m$1@dont-email.me>,
>> Janis Papanagnou  <janis_papanagnou+ng@hotmail.com> wrote:
>>> In GNU Awk I was looking for the in-place option (similar to sed -i).
>>> I thought there once was some _simple_ option usable from the command
>>> line. (Or am I misremembering?)
>>>
>>> The manual now suggests to use a GNU Awk "inplace" _Extension_ for that
>>>  gawk -i inplace ...
>>> and
>>>  gawk -i inplace -v inplace::suffix=.bak ...
>>> respectively.
>>>
>>> That's not exactly as simple to use as, say,
>>>  gawk -i ...
>>> and
>>>  gawk -i.bak
>>> so I suppose there's a reason for the added complexity in the handling.
>>>
>>> Does anyone know that reason or remember a rationale? - I don't recall
>>> any discussions about that...
>>
>> I've explained this a few times over the years (in this newsgroup).

It's no disrespect; my memory is just limited.

>>
>> There was never a "-i" option in Gawk that meant "inplace" (and there never
>> will be).
>>
>> The key to understanding this is to understand that (in Gawk), the "i" in
>> "-i" does not stand for "inplace".  It stands for "include".

No doubt. - What I wanted to say is that I thought there was a _simple_
option "like -i" (although, before 'include' times, it could have also
been '-i').

>>
>> Once you understand that, all becomes clear.

Unfortunately, the question about the rationale for using the GNU Awk
Extension mechanism - which was my original question - isn't answered
by that or any clearer.

> 
> Sure, but, interestingly, just like Janis, I also seem to have a false,
> memory of there having been some other inplace mechanism that was
> replaced by the -i inplace include (not necessarily a -i option).

I never needed the "inplace" feature with Awk[*] so my (wrong) memories
were not based on practical experience; practical experience would have
lead to a more enduring (likely correct) memory, I'd expect.

[*] On shell level I use a two-step process with a temporary, to make
processing typically also a bit more reliable.

> There is no evidence of any such in the available materials, though.
> 
> We might have both been duped by something unclear someone said once,
> (perhaps here)?

It's no biggie, I just wanted some clarity.

Thanks for the investigation.

Janis