The simplest way to proceed is to use sed
.
It‘s available both on Mac and Linux. Here is the gist of it:
sed -i 's/old/new/g' file.txt
Here we’re replacing old with new.
The -i
option will replace the string inplace. The /g
flag will replace every occurrences in the file.
Good reference: https://likegeeks.com/sed-linux/