现有大量.txt格式文本文件,其中内容为数据报表,呈现固定格式,现想提取其中部分异常数据,如何实现?如在“平均分”数据列里出现了大于100或小于0的数值,刚该数据为要提取的对象。注:数据量很大,搜索量很大
解决方案 »
- 如何代码实现更改桌面程序的路径?
- SQL select in 语句问题
- 在VB中,如何让line input读过一行后的文件指针再回退到刚读过的那一行的位置
- 求去掉字符串中的0的最简单的方法
- sp测试问题:用vb调用c生成的dll,出现 DLL 调用约定错误,请问怎么解决阿,谢谢!
- 祝冰mm生日快乐!
- VB中使用Active Reporter导致内存泄漏……
- sql的怪问题!!!!各位大侠过来看看!!高分哦!!!!!
- uguess(uguess) 作弊的证据:weixxxp是他的另外一个帐号!
- 那里有VB编的工业自动化监控程序提供下载?
- 关于年、月、日三个字段输入的有效性规则
- 求机子死机的代码....
Schema.ini 格式 http://blog.chinahr.com/blog/CareyBobo/post/57874
然后用查询语句来查询异常数据.
SN LCC-CD WARM-UP-LAL WARM-DW-LAL LA-CNT JK-CN
01 7406 0.00 43,992.27 0.00 0
02 7407 0.00 21,482.95 16.3 0
03 7417 732.05 0.00 0.00 0
04 841 364,827.50 0.00 1,614,973.45 91诸如以上格式的大量数据,“SN”、“LCC-CD”、“WARM-UP-LAL”、“LA-CNT”、“JK-CN”为字段名,下面为具体数据,现我想提取的是:“LCC-CD”列值为“7407”的行且该行“LA-CNT”列的值大于0.00。请高手指教,谢谢先!
SN LCC-CD WARM-UP-LAL WARM-DW-LAL LA-CNT JK-CN
01 7406 0.00 43,992.27 0.00 0
02 7407 0.00 21,482.95 16.3 0
03 7417 732.05 0.00 0.00 0
04 841 364,827.50 0.00 1,614,973.45 91诸如以上格式的大量数据,“SN”、“LCC-CD”、“WARM-UP-LAL”、“LA-CNT”、“JK-CN”为字段名,下面为具体数据,现我想提取的是:“LCC-CD”列值为“7407”的行且该行“LA-CNT”列的值大于0.00。请高手指教,谢谢先!
line input #1, strline 'skip header linedo until eof(1)
line input #1, strline
do while instr(strline, space(2))
strline = replace(strline, space(2), space(1))
loop
strarr = split(strline, space(1))
if ubound(strarr) then
if strarr(1) = "7407" and strarr(4) > "0.00" then list1.additem replace(strline, space(1), vbtab)
endif
loop
open "newfile.txt" for output as #2
line input #1, strline 'skip header line do until eof(1)
line input #1, strline
strtmp = strline
do while instr(strtmp, space(2))
strtmp = replace(strtmp, space(2), space(1))
loop
strarr = split(strtmp, space(1))
if ubound(strarr) then
if strarr(1) = "7407" and strarr(4) > "0.00" then print #2, strline
endif
loop
close #2
close #1
C:\sourcedata\02\02.txt,
C:\sourcedata\02\03.txt,
C:\sourcedata\02\04.txt,
C:\sourcedata\02\05.txt.
现要把新生成的文件存到如下路径:
C:\destinationdata\01\01.txt,
C:\destinationdata\02\02.txt,
C:\destinationdata\03\03.txt,
C:\destinationdata\04\04.txt,
C:\destinationdata\05\05.txt,
就是将sourcedata目录换成了destinationdata目录,子目录和文件名是一样的。
整个过程等与:遍历sourcedata目录,提取数据,生成新文件,放在destinationdata目录下。高手请帮忙,急用