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

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

Re: Setting $0 to fields after changing FS


From: Aharon Robbins
Subject: Re: Setting $0 to fields after changing FS
Date: Sat, 20 Nov 2010 22:35:16 +0200
User-agent: Heirloom mailx 12.4 7/29/08

Hi.

Unfortunately, I see this with the current stable gawk too.

Fortunately, the development, byte-code gawk, now available from Git
on Savannah, does not have this problem.  (Yay!)

If you really need a fix for gawk-stable, let me know. Otherwise, since
it's working in the development gawk, I'm happy. I will try to add
your program to the test suite.

Thanks,

Arnold

> Date: Sat, 20 Nov 2010 07:23:44 -0600
> From: Ed Morton <address@hidden>
> To: address@hidden
> Subject: Setting $0 to fields after changing FS
>
> I found this on cygwin on Windows XP. Notice the control characters on the 
> final line of output.
>
> Reading http://www.gnu.org/manual/gawk/html_node/Bugs.html didn't point me to 
> the list of known bugs, so I don't know if this is a known problem or not.
>
> Regards,
>
>      Ed Morton.
>
> ------------------------------------------------------------------------------------------------------------------------
>
> $ gawk --version | head -2
> GNU Awk 3.1.6
> Copyright (C) 1989, 1991-2007 Free Software Foundation.
>
> $ cat -v tst.awk
> BEGIN {
>          FS = "-"
>          $0="foo,bar"
>          printf "FS=<%s> NF=<%d> $0=<%s> $1=<%s> $2=<%s>\n",FS,NF,$0,$1,$2
>
>          FS = ","
>          $0 = $1
>          printf "FS=<%s> NF=<%d> $0=<%s> $1=<%s> $2=<%s>\n",FS,NF,$0,$1,$2
>
>          $0 = $2
>          printf "FS=<%s> NF=<%d> $0=<%s> $1=<%s> $2=<%s>\n",FS,NF,$0,$1,$2
>
> }
>
> $ gawk -f tst.awk | cat -v
> FS=<-> NF=<1> $0=<foo,bar> $1=<foo,bar> $2=<>
> FS=<,> NF=<2> $0=<foo,bar> $1=<foo> $2=<bar>
> FS=<,> NF=<1> $0=<M-TM-^]^T> $1=<M-TM-^]^T> $2=<>



reply via email to

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