Everybody knows how long and tedious it can be to write cover letters, especially when looking wordwide for a master degree. Therefore I wrote a template file with variables at the place I want to write specific sentences I stored in a second file depending on the master. How can I generalize a script to fill in the variables of the first file in several files dependng on the master?Here is the cover letter template :Dear Madam, dear Sir,I want to join Master X1 because blablabla...I want to specialise in X2 in order to X3...And here are what the variables are equal to for instance :X1 : MODO// ISI// MIAGE-IFX2 : Optimization // Artificial Intelligence // Financial Computer ScienceX3 : Optimize things // replace my brain ;) // make money :pI tought of scripting because sed is a powerfull tool to do it but I ony know how to do it for a specific query. If you think of other languages or even tool, I'm open to be critcized !
How to automatize writing from a template in several files depending on different inputs with a script?
scripting
I don't want to recommend writing letters in that way. With respect to your purpose of variable substitution, transpose your table (args.txt):MODO , Optimization , Optimize thingsISI , Artificial Intelligence , replace my brain ;)MIAGE-IF , Financial Computer Science , make money :pand iterate over rows:while IFS=',' read -r a b c; doecho Dear Madam, dear Sir,I want to join Master $a because blablabla...I want to specialise in $b in order to $c...done < args.txt