On Thu, 30 Dec 2004 01:08, Alasdair Tennant wrote:
> On Tue, 28 Dec 2004 18:52:32 +1300
>
> Andy Leach <[EMAIL PROTECTED]> wrote:
> > However, totaly bending my brain out of shape this afternoon & evening

>
> One (admittedly crappy) way to truncate to integer:
>
>     echo 1234.567890|sed s/\\..*//
>
> For rounding you have to add .5 first.

One could use bc itself
[EMAIL PROTECTED] ~ $ echo "scale=0; (3.4999 + 0.5)/1.0" | bc
3
[EMAIL PROTECTED] ~ $ echo "scale=0; (3.5001 + 0.5)/1.0" | bc
4

-- 
Sincerely etc.,
Christopher Sawtell

Reply via email to