Code:
alias clonescan {
  var %chan = $iif($left($1,1) == $chr(35),$1,#), %type = $iif($2,$2,$iif($left($1,1) == -,$1)), %tclones = 0
  if (%chan !ischan) {
    echo $colour(info) -a * Please enter a valid channel, ie. a channel that you are in.
    return
  }
  if ($chan(%chan).ial != $true) {
    .ial on
    echo $colour(info) -a * Updating IAL for %chan
    set %cs.chan $addtok(%cs.chan,%chan,32)
    raw -q WHO %chan 
    set %cs.type %type 
    return
  }
  else {
    if ($hget(cs)) { hfree cs }
    hmake cs $nick(%chan,0)
    var %i = 1, %ticks = $ticks, %clones
    while ($nick(%chan,%i)) { hadd cs $address($nick(%chan,%i),2) $hget(cs,$address($nick(%chan,%i),2)) $iif($numtok($hget(cs,$address($nick(%chan,%i),2)),38) > 0,$chr(38)) $nick(%chan,%i) | inc %i }
    var %o = 1
    echo -a -
    echo -a * Clone Scan in %chan
  }
  while ($hget(cs,%o).item) {
    if ($numtok($hget(cs,$hget(cs,%o).item),38) > 1) {
      echo -a $numtok($hget(cs,$hget(cs,%o).item),38) => $hget(cs,%o).item $+ : $hget(cs,$hget(cs,%o).item)
      inc %tclones $numtok($hget(cs,$hget(cs,%o).item),38)
      inc %clones
    }
    inc %o
  }
  echo -a * Done. $iif(%clones > 0,%clones,no) group $+ $iif(%clones > 1,s) of clones found, for a grand total of %tclones clones. (done: $+ $calc($ticks - %ticks) $+ ms)
  echo -a -
  hfree cs
}


I don't recall who, but I got this from someone in #helpdesk at DALnet. It returns the results in the following format:

* Clone Scan in #channel
x => *!*@host: nick & nick & ....
* Done. x groups of clones found, for a grand total of x clones. (done:xms)

...where the bold text represents variable data which depends on the channel and clones involved. You can use this to help you do what you want.


Acquire. Analyze. Adapt.