Replace String in a File Use sed: sed -i '' "s/old string/new string/g" myfile.txt On Linux use: sed -i 's/old string/new string/g' myfile.txt NOTE: Replacements are case sensitive. Refs Docs: https://linux.die.net/man/1/sed