I have a script that works to grab each line from files and lists the count, but what I also want is to grab only the unique instances from column 3. For example the lines say things like in the pic below, and while my current script counts all instances of COMM_CONT, that I really want is for it to count the unique lines that feature COMM_CONT, which for the pic would be 2.
So what I want it to have the below script count the unique number of the times the four patterns happen. I feel like it should be an easy fix, but I keep trying the -u and -uniq and I can't seem to get it to do it.
#!/bin/bash
ORAL_MICRO=$(awk -F ',' '/ORAL_MICRO/{print $3;}' $1 | wc -l)
LAB_CONT=$(awk -F ',' '/LAB_CONT/{print $3;}' $1 | wc -l)
COMM_CONT=$(awk -F ',' '/COMM_CONT/{print $3;}' $1 | wc -l)
IMMUNE=$(awk -F ',' '/IMMUNE/{print $3;}' $1 | wc -l)
echo $1, $ORAL_MICRO, $LAB_CONT, $COMM_CONT, $IMMUNE >> $2