Hello there I have run into that problem:
The following code does not replace line that contains $variable1 with the content of $variable2:
variable1=$(cat pathtofile1 | grep -w "something.more")
variable2=$(cat pathtofile2 | grep -w "something.else")
sed -i 's/$variable1/$variable2/g' pathtofile1
I want to copy the entire line from one file to another but it doesn't work, I think it has to do something with the dots in the variable's content but I don't seem to get it fixed no matter what.
Can someone help?
Thanks in advance.
EDIT: Edited the question because it was not clear enough what I wanted to do. I want to replace the line in file1 that contains the quoted text with the line of file2 that contains the second quoted text.