【发布时间】:2020-07-16 00:41:11
【问题描述】:
我有一个输入文件,我想做一个搜索/替换、乘法和转储输出文件。我在 TCL 中如何做到这一点?
- 所有数字都需要乘以 10 的倍数。
- 它需要查找 SECTION 和 END SECTION 并找到单词“shape”并将所有数字乘以 10。
输入文件
heading
size 9 XY 9
section1
shape name 1 2 3 4
end section1
section 2
shape name 1 2 3 4
end section2
输出文件:
heading
size 90 XY 90
section1
shape name 5 10 15 20
end section1
section 2
shape name 100 200 300 400
end section2
tcl
set multiplier1 10
set multiplier2 5
set multiplier3 100
while {[gets $infile1] > 0} {
if {[regexp "size" $value]} {
}
【问题讨论】: