View Single Post
Old 05-24-2005, 01:04 PM  
Too much time...
Join Date: Jul 2003
Posts: 1,430

You're right for the second file, you need to open the data stream / file before reading anything from it. Also "gets" will only read one line from the file (starting where the current file pointer is). You can use "read" instead ; it'll read the whole file. I have also added a "-types f" switch to the "glob" command to make sure all files are files and not directories (or anything else).

I guess "underdog" appears in all the names of the logfiles you want to merge.

proc savePrelog {dir logfile} {
   set data ""
   set logfiles [glob -nocomplain -directory $dir -types f -- "*underdogs*.log"]
   foreach logfile $logfiles {
      set in [open $logfile r]
      set data [read $in]
      close $in
      set out [open $logfile a]
      puts $out $data
      close $out
   return $logfile
I hope this helps.
Good luck
Harm is offline