Replace @-delimited string with expanded environment variable
The snippet can be accessed without any authentication.
Authored by
Marcel Loose
The perl
one-liner below will replace every occurrence of @some_string@
with the value of the environment variable some_string
(i.e. what you get when you echo ${some_string}
). For example, suppose you've got a file that contains the following text:
I like to eat @FRUIT@ @WHEN@.
If you run the one-liner on this file, with the environment variables FRUIT=apples
and WHEN=daily
, then the output will be:
I like to eat apples daily.
snippetfile1.txt 35 B
Please register or sign in to comment