sed
sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).

sed
sed ‘ s/string1/string2/ ‘ file1.txt
This command substitutes and replaces the first occurance of string2 with string1.
sed ‘ s/string1/string2/2 ‘ file1.txt
This command substitutes and replaces the second occurance of string2 with string1.
sed ‘ s/string1/string2/g ‘ file1.txt
This command substitutes and replaces all occurences of string2 with string1. The /g stands for global.
sed ‘ s/string1/string2/3g ‘ file1.txt
This command replaces string2 with string1 from the third occurance and beyond. Any number can be added to that range.