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 std.file, std.array;
 
void main() {
    auto from = "Goodbye London!", to = "Hello, New York!";
    foreach (fn; "a.txt b.txt c.txt".split()) {
        write(fn, replace(cast(string)read(fn), from, to));
    }
}