#include <File.au3>
#include <Array.au3>
Dim $aOld, $aNew[1]
$count = 0
$fileOld = "1.txt"
$fileNew = "2.txt"
_FileReadToArray($fileOld, $aOld)
For $i = 1 To UBound($aOld) - 1
$er = _ArraySearch($aOld, $aOld[$i])
If $er = $i Then
_ArrayAdd($aNew, $aOld[$i])
$count += 1
$aNew[0] = $count
EndIf
Next
_FileWriteFromArray($fileNew, $aNew)