- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to extract interface name and IP from ifcon...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 03:43 PM
04-28-2004 03:43 PM
lan0: flags=843
inet 19.79.191.17 netmask ffffff00 broadcast 19.79.191.255
lan0:1: flags=843
inet 19.79.191.18 netmask ffffff00 broadcast 19.79.191.255
lan0:2: flags=843
inet 19.79.191.20 netmask ffffff00 broadcast 19.79.191.255
now I need a script to extract only the interface name and the IP. The o/p should be something like this,
lan0 19.79.191.17
lan0:1 19.79.191.18
lan0:2 19.79.191.20
Pl. help.
Thanks,
Karthik S S
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:06 PM
04-28-2004 04:06 PM
Re: Script to extract interface name and IP from ifconfig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:09 PM
04-28-2004 04:09 PM
Re: Script to extract interface name and IP from ifconfig
Thanks anyway
-Karthik S S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:11 PM
04-28-2004 04:11 PM
Re: Script to extract interface name and IP from ifconfig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:17 PM
04-28-2004 04:17 PM
Re: Script to extract interface name and IP from ifconfig
That doesn't seems to be working for me. I prefer a script that can do the task using the input file as I specified above.
Thanks,
Karthik S S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 04:22 PM
04-28-2004 04:22 PM
Re: Script to extract interface name and IP from ifconfig
ifconfig: no such interface
if you have a physical card that shows up under lanscan but is not configured.
Sorry, I misunderstood your original post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2004 05:23 PM
04-28-2004 05:23 PM
Re: Script to extract interface name and IP from ifconfig
The below script works for me.Give the input file as argument to the script.
typeset -i z
x=`cat $1|awk '/lan/{print $1}'`
y=`cat $1|awk '/inet/{print $2}'`
z=1
for i in $x
do
a=`echo $y|cut -d " " -f$z`
i=${i%?}
echo $i "\t" $a
z=z+1
done