Counting unique values in a column with a shell script
Posted
by Lilly Tooner
on Stack Overflow
See other posts from Stack Overflow
or by Lilly Tooner
Published on 2010-05-06T13:31:06Z
Indexed on
2010/05/06
13:38 UTC
Read the original article
Hit count: 207
Hello. I have a tab delimited file with 5 columns and need to retrieve a count of just the number of unique lines from column 2. I would normally do this with Perl/Python but I am forced to use the shell for this one.
I have successfully in the past used *nix uniq function piped to wc but it looks like I am going to have to use awk in here.
Any advice would be greatly appreciated. (I have asked a similar question previously about column checks using awk but this is a little different and I wanted to separate it so if someone in the future has this question this will be here)
Many many thanks!
Lilly
© Stack Overflow or respective owner