perl -lane 'print unless $F[0] eq $prev;$prev=$F[0]' < file2.txt > file1.txt