REM DeDup.bat
REM This file compiles DeDup.vb to DeDup.exe
REM DeDup.exe Removes duplicate lines from StdIn and writes to StdOut
REM To use
REM DeDup < inputfile.txt > outputfile.txt
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:exe /out:"%~dp0\DeDup.exe" "%~dp0\DeDup.vb" /verbose
pause
'DeDup.vb
Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Imports Microsoft.Win32
Public Module DeDup
Sub Main
Dim Dict as Object
Dict = CreateObject("Scripting.Dictionary")
Dim Line As Object
Line=Console.readline
Do Until Line = vbnull
On Error Resume Next
Dict.Add(Line, "")
On Error Goto 0
Line=Console.readline
Loop
For Each thing in Dict.Keys()
Console.writeline(thing)
Next
End Sub
End Module
No comments:
Post a Comment