【发布时间】:2020-06-13 05:13:53
【问题描述】:
我的输入文件有 5 行,所有 5 行都打印到 1 个文件中。如何在放置期间打印一个文件中的每一行?如何增加现有文件名?
# Input file
1 2 3 4
1 3 4 5
2 3 4 5
1 2 3 4
set infile [open "infile.txt" r]
set outfile [open "outfile.txt" w]
set count 0
while {[gets $infile line] > 0} {
incr count
puts $outfile"$count" "I want to split the input file into 4 different files. Each file is one line"
}
好像TCL不喜欢上面的语法?我希望得到outfile1,outfile2.....
【问题讨论】: