Given a file of source lines that look like the following, I would like to splice together lines with escaped new lines but preserve the line numbers. [tomk] '''Input File''' ---- line(1) line(2)\ line with space after excape(3)\ line(4)\ line(5) line(6)\ line(7) line(8) ---- '''Solution''' set fid [open [file normalize "./filename"] r] set text [read ${fid}] close $fid regsub -all -- {[\\][ \t]*[\n]} ${text} "\\\n" text while { [regsub -all -- {[\\][\n](.*?[^\\])[\n]} ${text} "\\1\n\n" text] } {} '''Result''' % puts $text line(1) line(2)line with space after excape(3)line(4)line(5) line(6)line(7) line(8) %