Why not printf?

[geckos@csi24 ~]$ echo 1.0 | awk '{ printf("%d\n", $1); }'
1

Cheers,
- dhs

2015-09-25 11:12 GMT-03:00 Dave Wolaver <davewola...@gmail.com>:

> Michael Fainstein <Michael.Fainstein@...> writes:
>
> >
> > I saw such behavior in 'expr' when I upgraded bash 3.1 - it started
> printing floats instead of integers.
> > You can solve it using awk's OFMT:  awk '{OFMT="%.0f";print $1}'
> >
> > Michael
> >
>
>
> This worked for me, but it needed one small tweak... Need to add +0 so
> that awk actually applies the format.
>
> You can solve it using awk's OFMT:  awk '{OFMT="%.0f";print $1+0}'
>
> Thanks Michael!
>
>
>
> --
> _______________________________________________
> yocto mailing list
> yocto@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>



-- 
*"Do or do not. There is no try"*
  *Yoda Master*
-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to