export my_var=foo
echo "something {{my_var}} bar" | sed -r "s/\{\{(.*?)\}\}/$\1/g"
I want to grab the name of the token (my_var in this case) and then substitute in the value of the environment variable with the same name.
Is this possible? Current the above prints something $my_var bar rather than something foo bar which is what I want.
I'm open to using another tool such awk instead if it's not possible with sed.
--
You received this message because you are subscribed to the Google Groups "Bash One-liners" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bashoneliner...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.