Wednesday, March 5, 2008

bash command of the day: uniq

uniq removes duplicate entries from sorted output.
generally sort used in a pipe, and precede uniq.

man uniq for options,
it can substitute awk in some cases.

example of usage:


# get lines with unique 5 first characters
cat to_dolgop.txt | sort | uniq -w 5

No comments: