如果文本数据全部是固定的两位数,或许可以这样:- @set @n=0;/* & echo off
- pushd "文件夹1\"
- dir /b *.txt | cscript -nologo -e:jscript "%~0"
- pause & exit/b & rem */
-
- fso = new ActiveXObject("Scripting.FileSystemObject");
- while (!WScript.StdIn.AtEndOfStream) {
- f = WScript.StdIn.ReadLine();
- txt = fso.OpenTextFile(f, 1).ReadAll();
- ar = [];
- for (i=100; i<=199; i++) {
- j = (i + "").substr(1);
- n = txt.split(j).length;
- if (n > 1) ar.push(n + 100000000 + "=" + j)
- }
- ar.sort().reverse();
- s = ar.join(" ").replace(/\d+=/g, "");
- fso.CreateTextFile("..\\排序1\\"+f, true).WriteLine(s)
- }
复制代码
|