Created
July 9, 2016 19:55
-
-
Save thomaswilley/fcf84480a58d71ff7e89c354e5503283 to your computer and use it in GitHub Desktop.
One line template engine that pulls from environment variables. In this example environment variable DIR, contained w/in template infile as "$DIR", will all get replaced by results of `pwd` (current working directory) and the resulting populated template stored in outfile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIR=`pwd` awk '{ gsub("\\$DIR",ENVIRON["DIR"]); print $0 }' infile > outfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment