I have a file that looks something like this:
ABC
DEF
GHI
I have a shell variable that looks something like this:
var="MRD"
What I want to do is make my file like this:
ABC
MRD
DEF
GHI
I tried to do this:
sed -i -e 's/ABC/&$var/g' text.txt
but it only inserts $ var instead of value. I also tried this:
sed -i -e 's/ABC/&"$var"/g' text.txt
but that didn't work either. Any suggestions?
Thank!
source
share