perl -nle '/(\w*)/; print if (not exists $i{$1}); $i{$1}++;' words.txt