You'll want to read up on raw numerics if you plan on using this in a script.

Options:
1) /userhost <nick>
2) /who <nick>
3) /whois <nick>