来两个 js+bat- @set @bathome=1/*&echo off
- cscript -nologo -e:jscript "%~0" <a.txt
- pause&exit /b */
-
- var text = WScript.StdIn.ReadAll().split(/[\r\n]+/g)
- var i, j, object = {}, array = []
-
- for(i=text.length;i--;){
- var flag=true
- for(j in array){
- if(text[i]===array[j]){
- flag=false
- break
- }
- }
- if(flag)array.unshift(text[i])
- }
-
- WScript.Echo(array.join('\r\n'))
复制代码
- @set @bathome=1/*&echo off
- cscript -nologo -e:jscript "%~0" <a.txt
- pause&exit /b */
-
- var text = WScript.StdIn.ReadAll().split(/[\r\n]+/g)
- var i, object = {}, array = []
-
- for(i in text)object[text[i]]=i
- for(i in object)array.push({index:object[i],string:i})
- array = array.sort(function(a,b){return a.index-b.index})
-
- for(i in array)WScript.Echo(array[i].string)
复制代码
|