From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24660 invoked from network); 5 Dec 2006 08:18:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,RCVD_IN_BL_SPAMCOP_NET autolearn=no version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 5 Dec 2006 08:18:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75336 invoked from network); 5 Dec 2006 08:18:33 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Dec 2006 08:18:33 -0000 Received: (qmail 5033 invoked by alias); 5 Dec 2006 08:18:25 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11052 Received: (qmail 5022 invoked from network); 5 Dec 2006 08:18:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Dec 2006 08:18:25 -0000 Received: (qmail 74182 invoked from network); 5 Dec 2006 08:18:25 -0000 Received: from ug-out-1314.google.com (66.249.92.174) by a.mx.sunsite.dk with SMTP; 5 Dec 2006 08:18:22 -0000 Received: by ug-out-1314.google.com with SMTP id k3so2881124ugf for ; Tue, 05 Dec 2006 00:18:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CwuiK3ildoOfI+vNXG07wy0ws0lCL13SoAlnsQ9mNOqH+VOFQntxmY8gZDRv3AFKFrThdm5K2JU87z2xxh3QbDIiAvvqzqtLG04l4x5uaMJVzXgSX2FjI1/4KaS9XbgV1+sqtRl7HmsmEaDBHg2hnK0t3RvsMRJ8kEyOwhukACI= Received: by 10.78.158.11 with SMTP id g11mr8722962hue.1165306701954; Tue, 05 Dec 2006 00:18:21 -0800 (PST) Received: by 10.78.194.11 with HTTP; Tue, 5 Dec 2006 00:18:21 -0800 (PST) Message-ID: <237967ef0612050018w900242fg56980e09dfba3cb9@mail.gmail.com> Date: Tue, 5 Dec 2006 09:18:21 +0100 From: "Mikael Magnusson" To: zsh-users@sunsite.dk Subject: Re: Scripting situation I cannot wrap my head around In-Reply-To: <237967ef0612050017y1816e7fs66a3bdac8337fac3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <237967ef0612050017y1816e7fs66a3bdac8337fac3@mail.gmail.com> On 05/12/06, TjL 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