sort -t',' -k2,2 -u contacts.csv # Count duplicates instead of removing them: cut -d',' -f2 contacts.csv | sort | uniq -c | sort -rn