dup2.awk 142 B

1234
  1. $NF!=lastf2 {if(last2!="") print last2
  2. lastf2=lastf1; last2=last1; lastf1=$NF; last1=$0}
  3. $NF==lastf2 {print}
  4. END {print last2; print last1}