From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21304 invoked from network); 5 Dec 2006 15:41:13 -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=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham 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 15:41:13 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 1069 invoked from network); 5 Dec 2006 15:41:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 5 Dec 2006 15:41:06 -0000 Received: (qmail 13545 invoked by alias); 5 Dec 2006 15:40:51 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11056 Received: (qmail 13533 invoked from network); 5 Dec 2006 15:40:49 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 5 Dec 2006 15:40:49 -0000 Received: (qmail 98993 invoked from network); 5 Dec 2006 15:40:49 -0000 Received: from mx3-1.spamtrap.magma.ca (209.217.78.168) by a.mx.sunsite.dk with SMTP; 5 Dec 2006 15:40:46 -0000 Received: from mail4.magma.ca (mail4.internal.magma.ca [10.0.10.14]) by mx3-1.spamtrap.magma.ca (8.13.0/8.13.1) with ESMTP id kB5FehjZ029591 for ; Tue, 5 Dec 2006 10:40:43 -0500 Received: from princo.homelinux.org (ottawa-hs-209-217-84-17.d-ip.magma.ca [209.217.84.17]) by mail4.magma.ca (Magma's Mail Server) with ESMTP id kB5Fegva006146 for ; Tue, 5 Dec 2006 10:40:43 -0500 Received: from jrdavid by princo.homelinux.org with local (Exim 3.36 #1 (Debian)) id 1GrcPR-00035J-00 for ; Tue, 05 Dec 2006 10:40:41 -0500 Date: Tue, 5 Dec 2006 10:40:41 -0500 From: Jean-Rene David To: Zsh Users List Subject: Re: Scripting situation I cannot wrap my head around Message-ID: <20061205154041.GA10583@princo> Mail-Followup-To: Zsh Users List References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-magma-MailScanner-Information: Magma Mailscanner Service X-magma-MailScanner: Clean * TjL [2006.12.05 07:15]: > [...] > I am currently writing "verbatims" for a class > that I am taking. > [...] > 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 > > [...] 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). The 'separate counters for each person' sounds like a hash to me, and was suggested by others. However I think a text processing tool would be more appropriate than a shell for this kind of task: % perl -ne 'BEGIN { %person=(); } \ /^([a-zA-Z]+)(:)(.*)$/ && \ print "$1" . ++$person{$1} . "$2$3\n";' < dialog.file HTH, -- JR