1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/env -S awk -f { split($1, pos, "-") split($3, str, "") char = substr($2, 1, 1) # Count the frequency of char freq = 0 if (str[pos[1]] == char) freq++ if (str[pos[2]] == char) freq++ if (freq == 1) count++ } END { print count }