Tuesday, February 10, 2009

Unique lines in a file

If you want to see all unique lines within a file, use the uniq command within Linux/Unix. To do so, just execute uniq against a file.

#uniq /var/log/messages

Or, less elegantly...

#cat /var/log/messages | uniq

This will also work with standard input.

No comments: