1833862 Members
2405 Online
110063 Solutions
New Discussion

show only ip address

 
Paolo Gilli
Frequent Advisor

show only ip address

hi, I need a command to show only the ip address on my hp-ux 11.0
i found commands like netstat ioscan or ifconfig but they reurn to many information
(ifconfig lan0|grep inet
inet 192.168.1.228 netmask ffffff00 broadcast 192.168.1.255.)

I need only show the ip address (192.168.1.255)

any suggestion?
Thanks
6 REPLIES 6
Jerome Baron
Respected Contributor

Re: show only ip address

Hi,

Try ifconfig lan0|grep inet |cut -d " " -f 2


Regards,
jerome
Robert-Jan Goossens
Honored Contributor

Re: show only ip address

Hi,

How about something like

ifconfig lan0 | grep inet | awk {'print $2'}

Robert-Jan
T G Manikandan
Honored Contributor

Re: show only ip address

#getip

#ifconfig lan0|grep inet|awk -F " " '{print $2}'


Thanks
Steven Gillard_2
Honored Contributor

Re: show only ip address

How about:

$ getip $(hostname)

Regards,
Steve
Chuck J
Valued Contributor

Re: show only ip address

Hi

Here is a very easy way:

# ifconfig lan0 |grep inet| awk '{print $2}'

Chuck J
Paolo Gilli
Frequent Advisor

Re: show only ip address

Ok, problem solved.
thanks to all.