Task

Replace every occurring instance of a piece of text in a group of text files with another one.



For this task we want to replace the text   "Goodbye London!"   with   "Hello New York!"   for a list of files.




listOfFiles = {"a.txt", "b.txt", "c.txt"};
Do[
 filename = listOfFiles[[i]];
 filetext = Import[filename, "Text"];
 filetext = StringReplace[filetext, "Goodbye London!" -> "Hello New York!"];
 Export[filename, filetext, "Text"]
 , {i, 1, Length[listOfFiles]}]