I am writing a script to replace a string in a file in linux.
this is my code:
echo "Enter file name? "
read FILE1
echo "You have entered, $FILE1"
echo "String to be replaced "
read STR1
echo "You have entered, $STR1"
echo "Replace by "
read STR2
echo "You have entered, $STR2"
sed -i 's/$STR1/$STR2/g' /misc/home3/abc/$FILE1
echo "DONE !!"
The string is not getting replace in the file. what could be wrong with it??
Thanks :)
"s/$str1/$str2/g"