Don't know that this script has any application in the real world and after trying and failing twice at posting the script because of missed obvious bugs perhaps this try will succeed.
If inclined to play with the script, it is best to use 64-bit WiinBatch for files of any significant size. One of many likely issues is that paradoxically, the fewer the duplicates the longer the script will take because of additional FileWrites and a larger hash table.
; As usual, bugs are offered at no extra charge.
start = GetTickCount64()
BoxesUp("300,300, 500, 500", @Normal)
BoxTitle("Purging Duplicates From a File")
BoxText("This could take awhile...")
hIN = FileOpen(<Your file to purge here>, "Read")
hOut = FileOpen(<Your purged file here>,"Write") ;
Line = ""
Prev = IntControl(100, 1000000, 0, 0, 0) ; Adjust for fine tuning.
; Buffer could adjusted dynamically or
; simply made bigger. Memory usage should
; not be an issue on a modern 64-bit system.
hBuf = BinaryAlloc(100000)
PurgeMap = MapCreate()
Line = FileRead(hIn)
while Line != "*EOF*"
BinaryPokeStr(hBuf, 0, Line)
BinaryEodSet(hBuf, strlen(line))
; Using CRC32. MD5 may prevent false matches, collisions, and faster
; lookups but uses more string space.
Hash = BinaryChecksum(hBuf,2)
if MapKeyExist(PurgeMap, Hash)
Line = FileRead(hIn)
continue ; Skip record write.
endif
PurgeMap[Hash] = 0 ; Add record hash to table
FileWrite(hOut, Line)
Line = FileRead(hIn)
endwhile
; Clean up for no reason in particular.
BinaryFree(hBuf)
Drop(PurgeMap)
IntControl(100, Prev, 0, 0, 0)
FileClose(hIn)
FileClose(hOut)
secs = (GetTickCount64()-Start)/1000
Message("File Purge Completed", @lf:"Total time: ":secs/60:" minutes ":secs mod 60:" seconds")
exit