And for people like me who want the file name first on the line, this format works in Bash at least:
</dir/file sort | uniq >outfile
</dir/file sort | uniq >outfile
foo bar < a
foo < a bar
< a foo bar > a # from stdout to file
< a # simply the opposite operation: from file to stdin