Sed

Sed is a stream editor
Allows to replace some text

Simple example:

# Replace all occurences of John to Nick
sed 's/John/Nick/g' input.txt > output.txt

Example with regular expression:

sed -r 's/J[a-z]*n/Nick/g' input.txt > output.txt