The UNIX and Linux Forums  
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how grep the inet address for in ifconfig command mail2sant Shell Programming and Scripting 3 10-23-2008 05:17 AM
ifconfig: ce401001: bad address sag71155 IP Networking 2 06-19-2008 12:08 PM
Setting primary ip address with ifconfig pmichner IP Networking 5 08-30-2006 08:53 AM
ifconfig eth0 and awk and grep carlvernon UNIX for Dummies Questions & Answers 1 06-01-2006 01:17 PM
ifconfig bad address ppass SUN Solaris 2 03-11-2005 07:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-03-2008
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
how to grep only IP address of e1000g0 using ifconfig -a

Hello All,
Can someone show me how to cat "only the IP address of e1000g0" using ifconfig -a.
i am trying to grep only the ip address (xx.xx.xx.xx) from the bunch of all other things like, broadcast address, IPV4, UP........and so on.

thanks
  #2 (permalink)  
Old 11-03-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,307
Try this:

Code:
ifconfig -a | awk '/e1000g0/{p=1}p&&/inet addr/{sub(".*:", "", $2);print $2;exit}'
Use nawk or /usr/xpg4/bin/awk on Solaris.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:27 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0