How to count number of unique values of a field in a tab-delimited text file?

前端 未结 7 648
滥情空心
滥情空心 2020-12-23 14:21

I have a text file with a large amount of data which is tab delimited. I want to have a look at the data such that I can see the unique values in a column. For example,

相关标签:
7条回答
  • 2020-12-23 14:50

    Assuming the data file is actually Tab separated, not space aligned:

    <test.tsv awk '{print $4}' | sort | uniq
    

    Where $4 will be:

    • $1 - Red
    • $2 - Ball
    • $3 - 1
    • $4 - Sold
    0 讨论(0)
提交回复
热议问题