[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] [bug report] gawk doesn’t work correctly when assign spec
From: |
Jarno Suni |
Subject: |
Re: [bug-gawk] [bug report] gawk doesn’t work correctly when assign special value to variable |
Date: |
Mon, 10 Aug 2015 10:43:36 +0300 |
On Thu, 6 Aug 2015 15:55:50 +0800
> 3) Execute following command to see the result
> [root]# gawk -v var="00e1" '$2==var' 1.txt
> 00e1 00e1
> 00e2 00e4
>
> The second line should not be there. Because "00e4" is NOT equal to
> "00e1" obviously.
> Is it a bug or by design?
I think it is by design. At least mawk works the same way. Shell strips
the double quotes from the command line argument, so gawk sees it as
var=00e1.
> 3. Workaround:
> gawk -v var="00e1" '$2==""var' 1.txt
That is the way to make it string comparison explicitly.
--
Jarno Ilari Suni - http://www.iki.fi/8/
- [bug-gawk] [bug report] gawk doesn’t work correctly when assign special value to variable, Li Chao, 2015/08/06
- Re: [bug-gawk] [bug report] gawk doesn’t work correctly when assign special value to variable, Andrew J. Schorr, 2015/08/06
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Aharon Robbins, 2015/08/07
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Hermann Peifer, 2015/08/07
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Andrew J. Schorr, 2015/08/09
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Andrew J. Schorr, 2015/08/09
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Hermann Peifer, 2015/08/10
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Andrew J. Schorr, 2015/08/10
- Re: [bug-gawk] [bug report] gawk doesn???t work correctly when assign special value to variable, Hermann Peifer, 2015/08/11
Re: [bug-gawk] [bug report] gawk doesn’t work correctly when assign special value to variable,
Jarno Suni <=