replace lines of text by template