[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $0 reconstructed with separator OFS - instead of FS - upon change of
From: |
arnold |
Subject: |
Re: $0 reconstructed with separator OFS - instead of FS - upon change of a field |
Date: |
Sun, 19 Jan 2025 12:30:34 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
It's not a bug. Awk has behaved this way since Day 1. It's
well documented.
Arnold
"Jannick" <thirdedition@gmx.net> wrote:
> $0 is reconstructed when one of the fields ($i) is changed, however
> recomposed with OFS instead of FS as separator. This is unexpected and
> happens only when FS and OFS are different, of course. I guess this is a
> bug.
>
> A tiny example below. Expected output would be 'A:b'.
>
> Thanks
> J.
>
> ================
> $ gawk --version | head -n 1
> GNU Awk 5.3.1, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.3.0)
>
> $ echo a:b | LC_ALL=C gawk 'BEGIN{ FS=":"; } {print; $1="A"; print;}'
> a:b
> A b