awk replace string in file code example
Example 1: ubuntu command line replace word in files
sed -i 's/original/new/g' file.txt
Example 2: 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"