in tcl, how do I replace a line in a file?
Posted
by n00b programmer
on Stack Overflow
See other posts from Stack Overflow
or by n00b programmer
Published on 2010-05-12T11:03:30Z
Indexed on
2010/05/14
5:14 UTC
Read the original article
Hit count: 436
let's say I opened a file, then parsed it into lines. Then I use a loop:
foreach line $lines {}
inside the loop, for some lines, I want to replace them inside the file with different lines. Is it possible? Or do I have to write to another temporary file, then replace the files when I'm done?
e.g., if the file contained
AA
BB
and then I replace capital letters with lower case letters, I want the original file to contain
aa
bb
Thanks!
© Stack Overflow or respective owner