Here's the full code:

Code:
alias hs.replace { 
  var %a $1-
  var %i = 1, %x = $calc($lines(hs.txt) + 1)
  if (%x == 1) { halt }
  else {
    while (%i < %x) {
      var %search = /\b $+ $gettok($read(hs.txt,%i),1,32)\b/g
      var %replace = $gettok($read(hs.txt,%i),2-,32)
      $regsub(%a,%search,%replace,%a)
      inc %i
    }
    echo -a %a
  } 
}

Edit:
Fixed it: It wasn't combining the \g in the script ^^, so I changed it to:

Code:
var %search = $+(/\b,$gettok($read(hs.txt,%i),1,32),\b/g)

Last edited by Firstmate; 05/02/09 08:48 PM.