Couldn't resist, because I saw so many replys that suggested a piped combo of grep and awk.
Why on earth waste two processes with IPC involved where just one would suffice?
e.g.
# ifconfig lan0 | awk '$1~/inet/{print $2}'
Madness, thy name is system administration