Good day everyone, I followed the following Find and Replace Inside a Text File from a Bash Command.
Now I am using the sed
solution which seems to work if I use two predifined strings, but I want to replace the contents with something that is in a file, and not defined by me.
I have a file with the words "kung fu dog" i want it to be replace the word "dog" with the word "panda" but that word is in another file. I tried doing:
sed -i 's/dog/$(cat filethatcontainspanda)/g' /home/myhome
but the problem is that instead of having the word dog replaced with panda, I got the word "dog" replaced with "$(cat filethatcontainspanda)" so in the end instead of having "kung fu panda", I have "kung fu $(cat filethatcontainspanda)". Is there any workaround to this?