I have a tsv file. For a specific value in a column 5, I want to extract all the rows, and then cut three columns and then count the unique lines. For example for string 'abc' in column 5, I want
awk '$5 == "abc"' file.tsv | cut -f 1-3 | sort -u | wc -l
but I want to do this for all the unique strings in column 5 and not just 'abc'. There should be something like "for i in $5" but I am not exactly getting this 'for loop' thing. I can't give individual commands because there are so many strings.