Globally replace text in several files

var names = %w(
                a.txt
                b.txt
                c.txt
              )
 
names.map{ File(_) }.each { |file|
    say file.edit { |line|
        line.gsub("Goodbye London!", "Hello New York!")
    }
}

Last updated