Zsh Mailing List Archive
Messages sorted by:
Re: Generate files from a template with values from a list
- X-seq: zsh-users 11472
- From: "Lorenzo E. Danielsson" <danielsson.lorenzo@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Generate files from a template with values from a list
- Date: Fri, 4 May 2007 15:26:53 +0000
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=DoX3g3sXN/bf9v5TDrebzULI5MyEjRZtPPgGb+215wCZJ7LTXlbP1MoKI1wif5vZ5un9yYiQgWbrocZVZhvimx9iNsqUEkSUveCyb5Mdw4NHJMRjdHL0JwMTtL4f8+X0Ei4EFKB5wsuyruF1vio2CFt/t2gch2H72esS6yMTQrM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=gYcpItD84W6JB+4n6dOmHnLgHAFpNm/rYM/q0gN8bp6zgHrhy28KOGW5yi17jFU+pyonQBLSJA7cYIRBjwagxRtFeKCDYlwNWZCQjwfx5zb498yuekNYeqKfmeL6W1AbT6GAT6h/gl2psMx1ZTm8kfDU4Lb4BzjME2qd2vaWfTo=
- In-reply-to: <Xns99267020E6386zzappergmailcom@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9926797B3DB1zzappergmailcom@xxxxxxxxxxx> <20070504060311.GA7884@xxxxxxxxxxxxxxxxxxxx> <Xns99267020E6386zzappergmailcom@xxxxxxxxxxx>
On Fri, May 04, 2007 at 10:02:11AM +0000, zzapper wrote:
> Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote in
> > On 2007-05-03 at 23:45 +0000, zzapper wrote:
> >> I have an html template file which contains two fields xx_ and yy_
> >> I need to generate a number of copies of pages from this template each
> >> time replacing the fields xx_ and yy_ with values from a list.
> >> The list contains 49 xx_ yy_ pairs eg
> >> 11,234
> >> 15,235
> >> 21,236
> >> ..
> >> ..
> >> etc
> >> So I want to create 49 pages each populated from one pair from the list
> Thanks Phil,
> In fact a pure Perl solution turned out to be trivial.
> 1) Put list of xx_, yy_ pairs into an array of arrays
> 2) Put template into a hereis variable
> 3) for loop,substitute,write to file, Bob's Your Aunty
> always been interested in where the shell/perl script boundary is.
I really don't think there is a clear boundary. It's a matter of which
gets the job done (for you). In this case you found that implementing
the script in Perl did the job. Somebody else might have (equally
trivially) done the same thing in zsh, Ruby, or maybe even in Monty
Python's Flying Circus.
There are a few cases where I would argue that Perl is definately a
better choice than zsh. Equally, there are a few cases where I would say
that zsh is definately the better tool for the job. In all other cases
(that huge grey zone in between), it all depends on which one you are
more familiar with, what mood you are in, what you had for breakfast
and so on.
Messages sorted by: