Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion hoc output format

Newsgroups: comp.os.plan9
Path: g2news2.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!feed4.jnfs.ja.net!jnfs.ja.net!bath.ac.uk!news
From: rudolf.syk...@gmail.com (Rudolf Sykora)
Subject: Re: [9fans] hoc output format
Approved: plan9...@bath.ac.uk
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Sender: 9fans-boun...@9fans.net
Organization: Plan 9 mailing list
Message-ID: <AANLkTilG2V4cA0lqoIdU4kgIUNlptPR4ivdsU8cwFLIm@mail.gmail.com>
References: <84f53dabe8357c852216d6c9024f6eb0@coraid.com>
Mime-Version: 1.0
Date: Thu, 13 May 2010 15:23:05 GMT
Lines: 33

On 13 May 2010 16:23, erik quanstrom <quans...@labs.coraid.com> wrote:
>> > echo 1 2 | hoc -e '{while(read(x) !=3D 0)y +=3D x' ^ $nl ^ ' print y, =
"\n"}'
>>
>> Maybe it makes a sense to add in hoc(1) expression delimiter like a ';'?
>
> i don't use hoc very often. =A0i tend to use acid. =A0(!)
> this is because hoc won't do bit operations and doesn't
> accept hex.
>
> i typically do programming calculations and floating point
> just isn't the right way to do that.
>
> - erik
>
>

I've used hoc in my scripts to prepare some values which are then used
one for a calculation and second for naming a directory after this
value:

v =3D `{hoc -e $min+$step'*('$i-1')'}
mkdir $v

However, even for min=3D0 and step=3D0.05 (if I remember it right) for
some i I get a value like 6.50000000000something, which is annoying to
correct. That was the reason for my original question.
As proposed I will either add awk to format the result or use awk
exclusively in scripts. Nonetheless, maybe some control over the
format in hoc could be handy...

Thanks
Ruda