Bug 12591

Summary: awk requires parentheses around expressions
Product: Busybox Reporter: wolf+busybox
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: 1.31.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description wolf+busybox 2020-02-28 22:44:12 UTC
Following works in gawk

$ echo | awk -F. '{print $1 == 0 && $2 >= 7}'
0

however the same fails in busybox's awk

$ echo | busybox awk -F. '{print $1 == 0 && $2 >= 7}'
awk: cmd. line:1: Unexpected token

My understanding of https://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html#tag_04_06_13_16 is that the parentheses are optional there. When you add them, it starts to work:

$ echo | busybox awk -F. '{print ($1 == 0) && ($2 >= 7)}'
0