[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
An issue about gwak 3.1.1, is it a bug?
From: |
高磊 |
Subject: |
An issue about gwak 3.1.1, is it a bug? |
Date: |
Mon, 23 Jul 2007 15:22:20 +0800 |
Hi,
Here is an issue of gawk, may be a bug :
SYS: Linux 2.4.31-2bs #2 SMP Wed Mar 22 11:39:55 CST 2006 i686 i686 i386
GNU/Linux
GWAK: GNU Awk 3.1.1
I have a file named a.log,(the delimiter is Tab)
$ cat a.log
1abc 2abc
3abc 4abc
5abc 6abc
And then I wrote a command as:
$ awk 'FS="\t" gsub(/a/,"A",$1){print $0,NF}' a.log
1Abc 2abc 2
3Abc 4Abc 1
5Abc 6Abc 1
Why this? The delimiter of first line is space, but other lines is Tab)
I know the “FS=” is invalible,
but such command’s result is right:
$ awk '{FS="\t"; gsub(/a/,"A",$1);print $0,NF}' a.log
1Abc 2abc 2
3Abc 4abc 2
5Abc 6abc 2
I guess there is something wrong between “FS=” and “gsub”.
I am glad to receive any reply, thanksJ
Yours,
Gaolei
>From Baidu.com
- An issue about gwak 3.1.1, is it a bug?,
高磊 <=