I think the issues Glenn is having is with the duplicates. This should work.

Code:

dim $idArray
dim $emailArray
$ = open(1,'c:\blah.txt')
$curLine = trim(readline(1))
while @error=0
$lineArray = split($curLine,',')
$index = ascan($idArray, $lineArray[0])
if $index < 0
redim preserve $idArray[ubound($idArray)+1]
redim preserve $emailArray[ubound($emailArray)+1]
$idArray[ubound($idArray)] = $lineArray[0]
$emailArray[ubound($emailArray)] = $lineArray[1]
else
if not $emailArray[$index] and $lineArray[1]
$emailArray[$index] = $lineArray[1]
endif
endif
$curLine = trim(readline(1))
loop
$ = close(1)
for $j = 0 to ubound($emailArray)
if not $emailArray[$j]
$idArray[$j] ?
endif
next

_________________________
Eric