51Testing软件测试论坛

标题: 求TCL读写文件代码,在线等 [打印本页]

作者: 戒戒    时间: 2010-9-12 11:04
标题: 求TCL读写文件代码,在线等
小妹自动化测试新手,求tcl读文件和写文件的代码,文件是csv格式,读文件即想读取其中关键字下指定几行,写文件即要将每隔几秒得到的结果写入csv文件中,各位大虾救命啊!
作者: wn0112    时间: 2011-4-25 17:17
set src [ open $filepath1 r ]
set dst [ open $filepath2 w+ ]
while {[ gets $src data ]!=-1} {
if {[ regexp {匹配规则} $data ]} {
puts $dst $data
}
flush $dst




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2