awk replace string in file with variable code example
Example: awk replace string in file with variable
awk -i inplace -v cuv1="$word" -v cuv2="$replace" '{gsub(cuv1,cuv2); print;}' "$file"
Simpler solutions using sed and perl:
sed -i "s/$word/$replace/g" "$file"
perl -i -pe "s/$word/$replace/g" "$file"