887じゃないが、>>884はuniqではできなくてrubyなら簡単
cat <<EOF|ruby -e 'print ARGF.readlines.uniq'
aaa
bbb
ccc
ddd
EOF