Wednesday, September 30, 2009

UNIX command to find distinct values in a column

A file which has some duplicate numbers present in a column and if we need distinct values ,the following unix command can be used

$ > sort filename | uniq

Example: number.txt contains the following values

1
2
3
2
1


then the command sort number.txt |uniq willl result in
1
2
3

For more info,please refer
http://www.unix.com/shell-programming-scripting/77138-awk-print-distinct-col-values.html

1 comment:

Akhil said...

Nice Article. Some examples on find command

Powered By Blogger