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.




#!/usr/bin/lasso9
 
local(files = array('f1.txt', 'f2.txt'))
 
with filename in #files
let file = file(#filename)
let content = #file -> readbytes
do {
	#file -> dowithclose => {
		#content -> replace('Goodbye London!', 'Hello New York!')
		#file -> opentruncate
		#file -> writebytes(#content)
	}
}