I have a mustache like template file that needs to be parsed. e.g.
abc def ghijk{{ var1 }} lmno {{ var2 }} pq
rst={{ var3 }} uvwzyx
Variables like {{ var1 }}
need to be replaced by a variable with the same name, which is already defined previous in the bash script, e.g var1="foobar"
.
I am thinking of using while read
and awk
to accomplish this, but don't know what is the correct way to do string manipulation in this case.
Thanks in advance!