Hi,

I am looking to insert a couple of lines in the output. The problem is that when I try "puts $fh..." the lines are inserted only at the end of the output file and not immediately, where the last line was read...

I've attached a sample script to make more sense of my problem..... The output file which needs modification is attched after the script...

#------------
Sample script
#------------

set fh [open "...123.txt" r+]
while {[gets $fh line] > 0} {
        set temp $line
        if {[string eq [lindex $temp 0] "12345"]==1} {
                puts $fh "one two three four five"
                } elseif {[string eq [lindex $temp 0] "67890"]==1} {
                        puts $fh "six seven eight nine zero"
                } else { 
                }        
        }

#--#--#--#--#--
Existing output file

12345
45678
Insert the names of the above digits...
...immediately after the number
67890
90123
...& not at the end
This is the End of line. Do not print below this!!