Like this?- @echo off
- more +4 "%0" | mshta http://bathome.net/s/hta/ "eval(WSH.StdIn.ReadAll())"
- pause & exit /b
-
- dir().files().grep(/\.txt$/i)._each(
- function(file){
- bin=iconv.load(file)
- bom=iconv.checkBom(bin)
- if(bom=='undefined')bom=iconv.toStr(bin,'gb2312')?'gb2312':'utf-8'
-
- str=iconv.toStr(bin,bom)
- str=str
- .replace(/123/g,'345')
- .replace(/abc/g,'def')
- iconv.saveText(str,file,bom) //保存到源文件
-
- match1=str.match(/^(?=abc).*(?<=abc)$/mg)
- match2=str.match(/(([一-龥])?([一-龥])?([一-龥])?([一-龥])?[一-龥][一-龥])\1/g)
- match1=match1?match1:[]
- match2=match2?match2:[]
- arr = [].concat(match1,match2)
- iconv.saveText(arr.join('\r\n'),'提取'+file,bom) //保存到提取文件
- }
- )
复制代码
|