1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/env -S awk -f BEGIN { RS = "" FS = "\n" } { for (i = 1; i <= NF; i++) { len = split($i, answers, "") for (j = 1; j <= len; j++) count[answers[j]]++ } for (i in count) { if (count[i] == NF) sum++ } delete count } END { print sum }