'who' is your best bet, although the syntax you want is going to depend on your OS to some degree. i don't know what you'd be using netstat for. here's a chunk of code i use to get IP's under solaris and tru64/OSF1
OS=`uname`
if [ "$OS" = "SunOS" ]; then
IP=`who am i | cut -f 2 -d \( | cut -f 1 -d \)`
elif [ "$OS" = "OSF1"]; then
IP=`who -M am i | cut -f 2 -d \( | cut -f 1 -d \)`
fi