Pages

Monday, June 25, 2012

Awk oneliner for convering float to interger

echo  2.52690284 | awk '{printf "%.0f",$1}'

if in bash script

$SPEED="3.2"

SPEED=$(echo $SPEED | awk '{printf "%.0f",$1}')

echo $SPEED

No comments:

Post a Comment