In Cygwin:
$ getclip | sort -u $ ls -al | putclip
In Mac OS X:
$ pbpaste | sort -u $ ls -al | pbcopy
$ xclip -o | sort -u $ ls -al | xclip
(note that X has a somewhat funky notion of what a "clipboard" actually is, so the above may require some tweaking depending on your desktop environment)