首页 > 解决方案 > 在 MSQ 数据中查找 MILL

问题描述

我有看起来像的数据

121,736,52,0,5.295,0.000,70.000,3,1.0000,3,1  
122,736,52,0,5.295,0.000,70.000,3,1.0000,3,1  
123,736,52,0,5.295,0.000,70.000,3,1.0000,3,1  
124,736,52,1,5.295,1.000,70.200,3,1.0000,3,1  
124,736,52,OIND,70.200,27.641,-np-  
125,736,52,1,5.295,1.000,72.175,3,1.0000,3,1  
125,736,52,OIND,72.175,308.340,MILL    
129,736,52,1,5.295,1.000,70.525,3,1.0000,3,1  
129,736,52,OIND,70.525,76.211,MILL  

我需要存储以“MILL”或“-np-”结尾的所有数据,然后需要将其放入新的 MSQ 文件中

任何建议 语言是 TCL

标签: databasetclstorage

解决方案


就像是

set in [open yourfile r]
set out [open newfile w]
while {[gets $in line] >= 0} {
    if {[regexp {(?:MILL|-np-)$} $line]} {
         puts $out $line
    }
}
close $in
close $out

推荐阅读