Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Generate files from a template with values from a list



Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote in
news:20070504060311.GA7884@xxxxxxxxxxxxxxxxxxxx: 

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





Messages sorted by: Reverse Date, Date, Thread, Author