Getting the count of unique values in a column in bash
问题 I have tab delimited files with several columns. I want to count the frequency of occurrence of the different values in a column for all the files in a folder and sort them in decreasing order of count (highest count first). How would I accomplish this in a Linux command line environment? It can use any common command line language like awk, perl, python etc. 回答1: To see a frequency count for column two (for example): awk -F '\t' '{print $2}' * | sort | uniq -c | sort -nr fileA.txt z z a a b