Scalar variables in AWK can be either string, number or... strnum. See gawk's manual.
Conversion (especially in comparison and mathematical operations) is governed by these types as in the below table:
| STRING |
NUMERIC |
STRNUM |
| STRING |
string |
string |
| NUMERIC |
string |
numeric |
| STRNUM |
string |
numeric |
Jawk doesn't implement strnum and evaluates dynamically when to convert a String to a Number, and vice versa.
Consequence: the below script prints 1 with Jawk, while it should print 0 as with gawk:
BEGIN { r = 2 == "2.0"; print r }
More information can be found here (see the section "Expressions in awk")
Scalar variables in AWK can be either string, number or... strnum. See gawk's manual.
Conversion (especially in comparison and mathematical operations) is governed by these types as in the below table:
Jawk doesn't implement strnum and evaluates dynamically when to convert a
Stringto aNumber, and vice versa.Consequence: the below script prints
1with Jawk, while it should print0as with gawk:More information can be found here (see the section "Expressions in awk")