|
发表于 2018-1-17 14:01:55
|
显示全部楼层
回复 6# my3651
- set name "n1000gat"
- set f [open /xxxxxxxxxxx/test0001 r]
- while { [ gets $f line ] > -1 } {
- if { [ eval "regexp {$name,n\\d+gat,n\\d+gat} \$line" ] } {
- puts "line=$line"
- }
- }
- close $f
复制代码
测试处理下面的数据可以得到结果 line=N0R2_495(n1000gat,n419gat,n12529gat);
NOR2_496(n1004gat,n1000gat,n429gat);
NOR2_491(n1199gat,n1123gat,n1000gat);
N0R2_495(n1000gat,n419gat,n12529gat);
读取以上3行只输出最后一行, 不知是否正确? |
|