bug-gawk
[Top][All Lists]
Advanced

[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/



reply via email to

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