I\'m trying to replace a number that is in a couple different strings in a text file. Basically it would take the form of
tableNameNUMBER
carNUMBER
to replace 1111 to 2222 you should probably try
cat textfile.txt | sed -e 's/1111/2222/g'
or
cat textfile.txt | sed -e 's/1111/2222/g' > output.txt
or
NUMBER=1111 ; NEWNUMBER=2222; cat textfile.txt | sed -e "s/$NUMBER/$NEWNUMBER/g"
There's no need to create separate script for such trivial task. Note "-e" switch for sed, "g" appended at the end of quoted command, and the difference between single and double quotes.