perl -e '$name='kak';$q=do {open(F,"/tmp/file");}; $q=~ s/\$(\w+)/${$1}/g;; print $q' gives: select * from kak cat /tmp/file select * from $name