I don't think you can delete a line in a file, without, that is, making the previous line the last one!. There are plenty of ways around this but not the way you're trying to do it. Two obvious ones that come to mind are to open your file for reading and a temporary one for writing. Then read each line and write it to the temp file if it isn't blank. At the end, delete the original file and rename the temp file to the original file name.
The other is to open the file for reading, then read the whole file in as a list of lines (set linelist [split [read $fid] \n]). Then remove blanks from the list and write it out to the same file opened for writing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.