# using perl: uniq -c /tmp/d | perl -ne '($n,$s)=split(/\t/,$_,2); print $s if $n == 1' # using grep/cut (make sure that's a real tab after the 1 in the grep) uniq -c /tmp/d | egrep '^ *1 ' | cut -d\t -f2