|
Convert string to numeric
Hi,
I have read some figures from a text file by getting the position and wish to do some checking, but it seem like it won't work.
eg. my figure is 0.68 it still go the the else statement,
it seems like it treat it as a text instead of number.
Anybody can Help ? Thanks.
# only one line
cat $outfile | while read line
do
f1=$(echo $line|cut -c 14-17)
f2=$(echo $line|cut -c 19-22)
f3=$(echo $line|cut -c 24-27)
done
echo $f1 $f2 $f3
a=$f1
x=0.5
if [ $a -gt $x ]
then
echo 'Grater ' $f1 $f2 $f3
else
echo 'is ok :'
fi
|