when I want to check if a returned value is integer or not I use this in bash script:
if [ -z "$value" ]
then
echo 0
else
echo $value
fi
I was trying to use z option in awk with if. for example i have this line:
PRIMARY SECONDARY CONNECTED 350 800
I tried using this:
/bin/awk '{if( -z $1){print "0"}else{print $1}}' script
no matter i replace $1 with $2 or $3 or $4 or $5 it always return 0. am I using awk in a wrong way?