我有一个名为 time.dat 和 acc.dat 的文件,它们都包含一个包含数值的列。我想从这些文件中创建包含文件中值的列表。有谁知道该怎么做?
proc ReadRecord {inFilename outFilenameT outFilenameS} {
if [catch {open $inFilename r} inFileID] {
puts stderr "Cannot open $inFilename for reading"
} else {
set outFileIDS [open $outFilenameS w]
set outFileIDT [open $outFilenameT w]
foreach line [split [read $inFileID] \n] {
if {[llength $line] == 0} {
continue
} else {
puts $outFileIDT [lindex $line 0]
puts $outFileIDS [lindex $line 1]
}
}
close $outFileIDT
close $outFileIDS
close $inFileID
}
};