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.




import strutils
 
let fr = "Goodbye London!"
let to = "Hello, New York!"
 
for fn in ["a.txt", "b.txt", "c.txt"]:
  fn.writeFile fn.readFile.replace(fr, to)