well, I was thinking more like this:
Code:

break on
dim $Out, $FileArray, $file
dim $outArray, $line
$Out = @scriptdir + "\result.txt"
$FileArray = @scriptdir + "\file1.txt",@scriptdir + "\file2.txt",@scriptdir + "\file3.txt"

if open(2,$Out,5) "failed to open output file, quitting" quit endif

for each $file in $FileArray
if open(1,$file) = 0
$line = readline(1)
while @error = 0
if ascan($outArray,$line) < 0
redim preserve $outArray[ubound($outArray)+1]
$outArray[ubound($outArray)] = $line
$ = writeline(2, $line + @crlf)
endif
endif
$line = readline(1)
loop
$ = close(1)
endif
next
$ = close(2)

_________________________
!

download KiXnet