[ALUG] Bash Templating

Richard Parsons richard.lee.parsons at gmail.com
Thu Jul 22 09:36:33 BST 2010


Can anyone recommend to me a commandline templating system?

I want to be able to store information about clients and cases in simple text files and then merge that information into precedent documents.  I'll then save and print those documents.

My perfect script would be something like this:

echo "name='Richard Parsons'\naddress='10 Green Hill etc'" > me.txt
echo "name='Miles Davies'\naddress='14 Jazz Road etc'" > miles.txt
echo "Hey $to.name of $to.address,\nGreat album!\nTake care,\n$from.name of $from.address" > precedent.txt
magic-template-script -from me.txt --to miles.txt < precedent.txt > letter.txt

I'm thinking of using Cheetah (http://www.cheetahtemplate.org/), but am not particularly attached to it.  I want something that I can run straight from bash if possible, but if scripting is necessary I most prefer python.

Any comments or thoughts?


More information about the main mailing list