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!
file rename
calls to first move the old file to backup and then the new file to the proper name. Or to usefile link -hard
to make the backup andfile rename -force
to move the temporary into place. – Gwalior