Reputation: 1661
Here is the sample output:
$echo "0.0.0.0 : 0.0.0.0" | awk -F':' '{print $1==$2}'
0
Why are the strings not equal? What do I need to do to make awk think
Upvotes: 1
Views: 54
Reputation: 158150
This happens because you are using :
as the delimiter. $1
will contain 0.0.0.0<space>
and $2
will contain <space>0.0.0.0
You can specify a sequence of characters as delimiter:
... | awk -F' : ' '{print $1==$2}'
The above command is using the sequence: space colon space as delimiter.
Upvotes: 5