Question : Problems with cut

Can someon tell me what's wrong with this line of code:
var3=`$var1 | cut -d ' ' -f1`
print $var3
WhenI run it I get the following:
./C21Test[24]: COUNT(*):  not found

The value of var1 is: COUNT(*) ---------- 761612

This line of code: print $var1 | cut -d ' ' -f3
produces: 761612

Why isn't var3 getting assigned the output of my cut function??
Thanks...

Answer : Problems with cut

Should be:

var3=`echo $var1 | cut  -f3`

or better to do

var3=`echo $var1 | awk '{print $3}'`

The awk version handles all types of whitespace.
Random Solutions  
 
programming4us programming4us