bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: bug in GNU Awk 3.1.6 - problem with OFS


From: Aharon Robbins
Subject: Re: bug in GNU Awk 3.1.6 - problem with OFS
Date: Fri, 04 Jan 2008 14:12:13 +0200

Greetings. Re this:

> Date: Thu, 03 Jan 2008 01:32:04 +0300
> From: Yuri Malykhin <address@hidden>
> Subject: bug in GNU Awk 3.1.6 - problem with OFS
> To: address@hidden
>
> The variable OFS seems working strange:
>
> $ echo "1 2 3" | awk 'BEGIN{OFS=":"}{print}'
> -| 1 2 3
>
> while
>
> $ echo "1 2 3" | awk 'BEGIN{OFS=":"}{$1=$1;print}'
> -| 1:2:3
>
> Note: I use Cygwin.

Gawk is behaving correctly. In the first case, a bare "print" is the
same as "print $0".  $0 is the full input record, including the orginal
input white space.

In the second case, once a value is assigned to any field, the entire
record $0 must be rebuilt when it's needed; this is done by concatenating
the fields with the value of OFS.

I believe that this is all clearly explained in the gawk documentation.

Thanks,

Arnold




reply via email to

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