去重复可以用这个- @if (0)==(0) echo off
- title 保存为ANSI编码,处理ANSI编码的TXT文件
- for /d %%a in (*) do (pushd %%a
- cscript -nologo -e:jscript "%~f0" "a.txt" "b.txt">"提取.txt"
- popd
- )
- pause&exit/b
- @end
-
- var s = '', a = {}, files = WScript.Arguments;
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- for (var i = 0; i<files.length; i++){
- var f = fso.opentextfile(files(i), 1);
- while(!f.AtEndOfStream){
- var str = f.ReadLine();
- var str = str.replace(/^[^,]+,(?!,,),.+$/mg,'');
- if(!a[str]){
- a[str] = 1;
- s += str+'\r\n';
- }
- s = s.match(/^[^\r\n]+\r\n/mg).join('');
- }
- f.Close();
- }
- WSH.echo(s);
复制代码
|