frequency count for file column in bash

后端 未结 3 1054
滥情空心
滥情空心 2021-01-25 18:12

I have a file with 8 columns using | as a delimiter and I want to count the occurence frequency of the words in the 8th column. I tried awk like this



        
3条回答
  •  遇见更好的自我
    2021-01-25 18:21

    A cut based answer, (plus an bit of sed to surround items with quotes, the better to make blank lines visible):

    cut -d'|' -f8 "$FILE" | sed 's/.*/"&"/' | sort | uniq -c
    

提交回复
热议问题