I am trying to replate a pattern (that contains many specials chars) with a simple string that I have in a file called "file". I''m using sed to get it done. The command runs without any exception but the target file remains the same...
I'm trying to replace this:
<%=ENV["SECRET_KEY_BASE"]%>
with this (the content in the file):
88ce3e2c0fa0b667567dc370f8c62019ee88f1628ee1586651d7ea4a0faf18d0dbccaeb3f21c46109d2087ff31f07cf3734ce7a38f64f5a92cdf91dcb3494d1f** ... in a file called **secrets.yml
That's the commands I've tried but doesn't seem to work:
sed -i 's/<%=ENV["SECRET_KEY_BASE"]%>/$(cat file)/g' config/secrets.yml
also tried with variables this way, but nothing changed:
var1="<%=ENV["SECRET_KEY_BASE"]%>" && var2="`cat file`" && sed -i 's/$var1/$var2/g' config/secrets.yml
Does anyone have an idea what i'm missing here?