How would I search for and replace a string of data in a text file?

Example:

Hello.txt contains multiple strings of "abcdefg".

I want to replace every instance of "abcdefg" with "1234"

Can some explain to me how to do that.