本帖最后由 aloha20200628 于 2024-10-28 11:09 编辑
回复 23# 66899981
重体力劳动让 js 一锅烩吧,比22楼版本明显提速...
- @set @x=1 /* &@echo off
- type "data.txt"|cscript /nologo /e:jscript "%~f0" "匹配数超长字符串.txt">0.0
- move /y 0.0 data.txt >nul 2>nul
- pause&exit/b */
- v=WSH.arguments, fso=WSH.createObject('Scripting.FileSystemObject');
- fp=fso.OpenTextFile(v(0),1), akw=fp.readall().replace(/\r\n/g,'').split(' '), fp.close();
- ws=WSH.stdin, lines='';
- while (!ws.atendofstream) {
- line=ws.readline();
- for (cut=0,n=0,l=akw.length; n<l; n++)
- if (line.indexOf(akw[n]) != -1) { cut=1; break; }
- if (cut==0) lines+=line+'\r\n';
- }
- WSH.echo(lines), WSH.quit();
复制代码
|