Advertisement
dcandygmailcom

DeDup.exe Removes duplicate lines from StdIn and writes to S

Feb 21st, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.85 KB | None | 0 0
  1. REM Two files follow
  2. REM DeDup.bat
  3. REM This file compiles DeDup.vb to DeDup.exe
  4. REM DeDup.exe Removes duplicate lines from StdIn and writes to StdOut
  5. REM To use
  6. REM DeDup  < inputfile.txt > outputfile.txt
  7. "C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /target:exe /out:"%~dp0\DeDup.exe" "%~dp0\DeDup.vb" /verbose
  8. pause
  9.  
  10. -----------------------------------------------------
  11.  
  12. 'DeDup.vb
  13. Imports System
  14. Imports System.IO
  15. Imports System.Runtime.InteropServices
  16. Imports Microsoft.Win32
  17.  
  18. Public Module DeDup
  19. Sub Main
  20.     Dim Dict as Object
  21.     Dict = CreateObject("Scripting.Dictionary")
  22.     Dim Line As Object
  23.     Line=Console.readline
  24.     Do Until Line = Nothing
  25.         On Error Resume Next
  26.         Dict.Add(Line, "")
  27.         On Error Goto 0
  28.         Line=Console.readline
  29.     Loop
  30.     For Each thing in Dict.Keys()
  31.         Console.writeline(thing)
  32.     Next
  33. End Sub
  34. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement