如何更新/写入如下;更新/写入行内容
1.首先案例:我想更新/只与内容格式在4号线这样的替换4号线新内容:第4行
变化指数2 none;none;C:\data\update\text.txt;onfiles
格式成为C:\data\update\new\newtext.txt
2。第二种情况:如何写入/替换第3行中的内容直到结束。
foreach line [split $data \n] {
incr count
if {$count <= 2} {
puts $fp $line ;#write old content
} elseif {$count == 3} { ;#update line 3 only with parameter below
if {not match/different content} {
#update/write...
} else {
#do not write or skip write (still use old content)
}
} else {
#new content/update...
#...
#...
#...
#until end what i need
}
}
请通过这个:http://stackoverflow.com/help/how-to-ask –