I've written a tcl program to read a file, do some massaging and output to another file. What I need to do initially is to strip off the first and last records. Is there a simple way to achieve this?
It depends on the size of the file. Assuming it's not too big (you decide what too big means), and that the records are linefeed-delimited, I like to do this:
Code:
set fid [open <filename> r]
set lstLines [split [read $fid] \n]
close $fid
set lstLines [lrange $lstLines 1 end-1] #first and last removed
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.