9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Rudolf Sykora <rudolf.sykora@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] hoc output format
Date: Thu, 13 May 2010 17:20:43 +0200	[thread overview]
Message-ID: <AANLkTilG2V4cA0lqoIdU4kgIUNlptPR4ivdsU8cwFLIm@mail.gmail.com> (raw)
In-Reply-To: <84f53dabe8357c852216d6c9024f6eb0@coraid.com>

On 13 May 2010 16:23, erik quanstrom <quanstro@labs.coraid.com> wrote:
>> > echo 1 2 | hoc -e '{while(read(x) != 0)y += 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.  i tend to use acid.  (!)
> 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 = `{hoc -e $min+$step'*('$i-1')'}
mkdir $v

However, even for min=0 and step=0.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



      parent reply	other threads:[~2010-05-13 15:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 10:24 Rudolf Sykora
2010-05-12 10:41 ` Alexander Sychev
2010-05-12 18:06   ` Akshat Kumar
2010-05-13  7:51     ` Alexander Sychev
2010-05-13 13:24       ` erik quanstrom
2010-05-13 14:06         ` Alexander Sychev
2010-05-13 14:23           ` erik quanstrom
2010-05-13 15:04             ` Ethan Grammatikidis
2010-05-13 15:09             ` Gorka Guardiola
2010-05-13 15:37               ` erik quanstrom
2010-05-13 15:16             ` roger peppe
2010-05-13 15:31               ` erik quanstrom
2010-05-13 15:53                 ` roger peppe
2010-05-13 16:06                   ` erik quanstrom
2010-05-13 16:16                     ` roger peppe
2010-05-13 15:54               ` Ethan Grammatikidis
2010-05-13 16:08                 ` roger peppe
2010-05-13 15:20             ` Rudolf Sykora [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTilG2V4cA0lqoIdU4kgIUNlptPR4ivdsU8cwFLIm@mail.gmail.com \
    --to=rudolf.sykora@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).