zsh-users
 help / color / mirror / code / Atom feed
From: "Mikael Magnusson" <mikachu@gmail.com>
To: zsh-users@sunsite.dk
Subject: Re: Scripting situation I cannot wrap my head around
Date: Tue, 5 Dec 2006 09:18:21 +0100	[thread overview]
Message-ID: <237967ef0612050018w900242fg56980e09dfba3cb9@mail.gmail.com> (raw)
In-Reply-To: <237967ef0612050017y1816e7fs66a3bdac8337fac3@mail.gmail.com>

On 05/12/06, TjL <luomat@gmail.com> wrote:
> My apologies for asking you all for what feels like a basic question,
> but I am missing something and cannot wrap my head around how to fix
> it.
>
> I am currently writing "verbatims" for a class that I am taking.  The
> teacher wants the verbatims to include a number for each time a person
> has spoken.
>
> An example will make this more clear.  Assume that John, Tim and
> George and talking.
>
> Here is "normal" dialog:
>
> John: How are you today?
> Tim: I'm good.
> George: I'm Ok, how are you
> John: I'm good too.
> George: Glad to hear it
> John: Thanks
> Tim: Yeah, me too
>
> Here is verbatim style dialog:
>
> John1: How are you today?
> Tim1: I'm good.
> George1: I'm Ok, how are you
> John2: I'm good too.
> George2: Glad to hear it
> John3: Thanks
> Tim2: Yeah, me too
>
> Notice that the number next to the name represents the number of times
> that person has said something (it doesn't matter WHO they said it
> to).
>
> What I am trying to do is figure out a way to have the numbering done
> for me, but I can't wrap my head around how to do that.  You would
> need separate counters for each person, and you wouldn't know how many
> people would be a part of the conversation (no fewer than 2 people,
> probably no more than 10, usually 2-5).
>
> I've tried to come up with WHILE loops or FOR loops using counters and
> such, but I can't get past the first hurdle, which seems to be: how to
> keep track of a counter for each speaker when you don't know how many
> speakers you will have.
>
> Any help appreciated.  The fact that it's 2:30am may have something to
> do with my brain fog (I hope!) so my apologies if I am missing
> something obvious!
>
> TjL

Maybe this will help

% typeset -A verbatim
% verbatim[John]=1
% verbatim[Tim]=3
% echo $verbatim
3 1
% echo $verbatim[John]
1
% echo $verbatim[Tim]
3

--
Mikael Magnusson
ps forgot to hit reply to all, as usual


  parent reply	other threads:[~2006-12-05  8:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-05  7:31 TjL
     [not found] ` <237967ef0612050017y1816e7fs66a3bdac8337fac3@mail.gmail.com>
2006-12-05  8:18   ` Mikael Magnusson [this message]
2006-12-05 14:35     ` Torur Andreassen
2006-12-05 15:40 ` Jean-Rene David
2006-12-05 23:43   ` Paul Johnson
2006-12-06 19:34     ` TjL

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=237967ef0612050018w900242fg56980e09dfba3cb9@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=zsh-users@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).