1. Symptom:
gawk doesn’s work correctly when assign special value (like 00e1) variable.
2. Steps to repeat this issue:
1) Download and compile the latest gawk 4.1.3
http://ftp.gnu.org/gnu/gawk/[root]# gawk --version | head -2
GNU Awk 4.1.3, API: 1.1
Copyright (C) 1989, 1991-2015 Free Software Foundation.
2) Prepare a test file
cat > 1.txt << EOF
00e1 00e1
00e2 00e4
00e3 00e1_01
EOF
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?
3. Workaround:
gawk -v var="00e1" '$2==""var' 1.txt
gawk -v var="^00e1$" '$2~var' 1.txt