本帖最后由 pcl_test 于 2016-4-6 00:29 编辑
猜- <!-- :
- @echo off
- for /f "delims=" %%a in ('dir /a-d/b *.txt^|mshta "%~f0"') do (
- if exist "*%%a*.txt" (
- md "%%a\" 2>nul
- move "*%%a*.txt" "%%a\"
- )
- )
- pause&exit
- -->
-
- <script src=http://www.bathome.net/lib/diy/hide.js></script>
- <script src=http://www.bathome.net/lib/diy/iconv.js></script>
-
- <script>
- var fso = new ActiveXObject('Scripting.Filesystemobject');
- var StdIn = fso.GetStandardStream(0);
- var StdOut = fso.GetStandardStream(1);
- var txtfiles = StdIn.ReadAll().split(/\r\n/);
- var log = fso.CreateTextFile('统计.log', 2);
- var s = f = '', arr = {};
-
- for(var i = 0; i<txtfiles.length; i++){
- var bin = iconv.load(txtfiles[i]);
- var bom = iconv.checkBom(bin);
- if(bom == 'undefined'){bom = iconv.toStr(bin, 'gb2312')?'gb2312':'utf-8';}
- var txt = iconv.toStr(bin, bom);
- var t = '';
- var str = txt.replace(/[ \t]*(第[零一二三四五六七八九十百千廿卅卌]+?卷)/g, function($0, $1){
- if(!arr[$1]){
- arr[$1] = 1;
- f += $1 +'\r\n';
- }
- t += $1 +',';
- var r = $1.replace(/[廿卅卌]/, function(a){return a=='廿'?'二十':a=='卅'?'三十':'四十'});
- return /第[一二三四五六七八九]{2}卷/.test(r)?r.substr(0, 2)+ '十' +r.substr(2, 2):r;
- });
- iconv.saveText(str, txtfiles[i], bom);
- s += fso.GetFile(txtfiles[i]).Name+ '\r\n' +t+ '\r\n\r\n';
- }
-
- log.Write(s);
- StdOut.Write(f);
- </script>
复制代码
|