文件ANIS编码,防重复处理- //&cls&dir /b *.txt|cscript -nologo -e:jscript "%~f0"&pause&exit
-
- function reStr(file){
- var f = fso.opentextfile(file, 1);
- str = f.ReadAll().replace(/^\s*(第[一二两三四五六七八九十○零百千0-9][节章])/gm, '###$1')
- .replace(/^\s*#+$/gm, '').replace(/^([\S\s]+)(\r\n)*$/gm, '$1\r\n\r\n###');
- f.Close();
- var f = fso.opentextfile(file, 2);
- f.Write(str);
- }
- var fso = new ActiveXObject('Scripting.FileSystemObject');
- while(!WScript.StdIn.AtEndOfStream)reStr(WScript.StdIn.ReadLine());
复制代码 大文件最好用EmEditor
^\s*(第[一二两三四五六七八九十○零百千0-9][节章])替换###$1 |