📅  最后修改于: 2022-03-11 14:55:07.435000             🧑  作者: Mango
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"