idro
1
Hi all,
I'm trying to convert a decimal number into an integer number; I'm doing this:
n=`echo |awk '{ print "'"$mem"'"*10}'`
where the variable mem is equal to 3.7
I'd like to obtain 37, but the expression above gives me 30.
Help please!!!!
thx a lot
Try
n=`echo "$mem * 10" | bc`
idro
3
It works, but now I obtain, 37.0.
I'd want 37.
echo '3.7 * 10' | bc | sed 's/[.].*//'
echo '3.7' | nawk '{printf("%d\n", $1 * 10)}'