Replace string in file with sed
sed 's/string/newstring/g' file.txt