Presuming the IP address is in $1, then use $+($gettok($1,1-3,46),.*)