awk '
/connection from/{ nr=NR; conn[nr]=$NF; auth_counter[nr]=0; next; }
{ auth_counter[nr]++; auth_msg[nr]=$NF; }
END{
for(i in auth_counter) if(auth_counter[i]==1) print conn[i], auth_msg[i]
}' file
x.x.x.x BBB
y.y.y.x CCC
x.x.x.a ZZZ
solved awk how to parse based on pattern but skip multiple similar lines and accept only single line occurence [closed]