For Programmers: Free Programming Magazines  


Home > Archive > AWK > July 2006 > FIELDWIDTH weirdness (gawk)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author FIELDWIDTH weirdness (gawk)
Neil Cerutti

2006-07-27, 6:56 pm

$ cat in.txt
4 7
3 40
8 12
20 4

$ cat test.awk
BEGIN {
FIELDWIDTHS = "2 2";
}
{
print $1, $2;
}

$ awk -f test.awk in.txt
4
3
8
20

$ gawk --version
GNU Awk 3.1.5
Copyright (C) 1989, 1991-2005 Free Software Foundation.

Changing the FIELDWIDTHS variable so that there's a "dummy" on
the end, makes it work as I expect, e.g., FIELDWIDTHS = "2 2 2".
This peculiarity doesn't seem to be covered in the documentation.

This is on Cygwin, in case that might be an issue.

--
Neil Cerutti
Facts are stupid things. --Ronald Reagan
Andrew Schorr

2006-07-28, 7:56 am

Is the problem fixed by this patch?

http://lists.gnu.org/archive/html/b...0/msg00085.html

FYI, it's probably a better bet to ask this kind of question
(about a bug in gawk) on the bug-gawk@gnu.org mailing list.

Regards,
Andy

Neil Cerutti

2006-07-28, 7:56 am

On 2006-07-28, Andrew Schorr <aschorr@telemetry-investments.com> wrote:
> Is the problem fixed by this patch?
>
> http://lists.gnu.org/archive/html/b...0/msg00085.html


That seems to be the case. Thanks so much.

> FYI, it's probably a better bet to ask this kind of question
> (about a bug in gawk) on the bug-gawk@gnu.org mailing list.


I wasn't aware of the bug-gawk archives. I'll take advantage of
them in the future. Thanks!

--
Neil Cerutti
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com