回复 11# mxarky - file = "要处理的文件.txt"
- var fso = new ActiveXObject("scripting.filesystemobject");
- var str = fso.OpenTextFile(file,1).ReadAll();
- var arr = str.match(/[0-8]{13}/gm);
- var retstr = '';
- for(var i=0;i<arr.length;i++){
- for(var j=0,sum=0;j<13;j++) sum+=arr[i].charAt(j)*1;
- if(sum==52||sum==39) retstr += arr[i] + ' ' + sum + '\r\n';
- }
- fso.OpenTextFile(file+"_ok.txt",2,1).Write(retstr);
- WSH.echo('完成');
复制代码
|