#! /bin/csh -f
# Last edited on 1999-08-19 12:03:49 by stolfi

cat /etc/ssh_known_hosts \
  | gawk \
      ' /^[^#]/ { \
          s = $1; nf = split(s, f, /[,]/); \
          for(i=1; i<nf; i++) { print f[nf],f[i]; } \
        } \
      ' \
  | sort | uniq \
  | gawk \
      ' /./ { \
          ip = $1; name = $2; \
          if((ip \!= oip) || (oname \!= substr(name,1,length(oname)))) \
            { if (oip \!= "") { printf "%-16s %s\n", oip, oname; } } \
          if((ip \!= oip) && (oip \!= "")) { printf "\n"; } \
          oip = ip; oname = name ; \
        } \
        END { if (oip \!= "") { printf "%-16s %s\n", oip, oname; } } \
      ' 
