Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Scripting situation I cannot wrap my head around
- X-seq: zsh-users 11056
- From: Jean-Rene David <jrdavid@xxxxxxxx>
- To: Zsh Users List <zsh-users@xxxxxxxxxx>
- Subject: Re: Scripting situation I cannot wrap my head around
- Date: Tue, 5 Dec 2006 10:40:41 -0500
- In-reply-to: <d2ecb10b0612042331l70ea16c9ubd8f676a8a0a126e@xxxxxxxxxxxxxx>
- Mail-followup-to: Zsh Users List <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <d2ecb10b0612042331l70ea16c9ubd8f676a8a0a126e@xxxxxxxxxxxxxx>
* 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author