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.




 
(define (replace-in-file filename this bythat)
   (set 'content (read-file filename))
   (when (string? content)
     (replace this content bythat)
     (write-file filename content)
   )
)
 
(set 'files '("a.txt" "b.txt" "c.txt" "missing"))
(dolist (fname files)
   (replace-in-file fname "Goodbye London!" "Hello New York!")
)
 
(exit)
 