4 ms·
`sed` text files as a replacement for templating. In the text file you have something you want to template (or "parametrize") from an outside variable, so you
by leonheld 3y ago
`sed` text files as a replacement for templating.
In the text file you have something you want to template (or "parametrize") from an outside variable, so you name that something like @@VAR@@ and then you can sed that @@VAR@@ :-)
- teddyh 3y agoI think the m4 macro processor might be the more canonical way to do it. Unless you’re writing a shell script, in which case a “here-document” with embedded $VARIABLES is more straightforward.
- _bbih 3y agoWait, you're telling me this isn't a Best Practice™?
- zblesk 3y agoIt totally is.
- Semaphor 3y agoThat's how we do it. Not with sed exactly, but string replacement. One is a bull email sender that only supports VBScript, the other is C#, but the users aren't supposed (or need) to have full templating powers, so this way it's easier.
- deleted 3y ago[deleted]