From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: <84f53dabe8357c852216d6c9024f6eb0@coraid.com> References: <158d5dc0571fa04cab44a99b3fdf5921@kw.quanstro.net> <84f53dabe8357c852216d6c9024f6eb0@coraid.com> Date: Thu, 13 May 2010 17:20:43 +0200 Message-ID: From: Rudolf Sykora To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [9fans] hoc output format Topicbox-Message-UUID: 205490c6-ead6-11e9-9d60-3106f5b1d025 On 13 May 2010 16:23, erik quanstrom 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