我做了以下,它工作得很好。
集FH [开/tmp/test.csv一个+] fconfigure $ FH -buffering线
这吐出来一行一行到文件中。因此,在我的脚本正在执行的任何特定时间点,我可以打开CSV文件并查看数据。其他选项包括以下内容 -
tcl> set fh [open test a+]
file13
tcl> fconfigure $fh -buffering none
tcl> puts $fh "line 1"
tcl> puts $fh "line 2"
tcl> puts $fh "line 3"
[[email protected] testserver]$ more test
line 1
line 2
line 3
tcl> fconfigure $fh -buffering full
tcl> puts $fh "line 4"
tcl> puts $fh "line 5"
tcl> puts $fh "line 6"
[[email protected] testserver]$ more test
line 1
line 2
line 3
tcl> fconfigure $fh -buffering line
tcl> puts $fh "line 7"
tcl> puts $fh "line 8"
tcl> puts $fh "line 9"
[[email protected] testserver]$ more test
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
[[email protected] test]$
谢谢Kenneth Aalberg和Donal研究员。
欣赏超快反应!
您可能希望检查您认为最有用的答案是“正确”(向其他潜在答复者表明您有答案),并且提出您认为有用的答案中的任何一个或两个答案。 – Simon