- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Quick scripting 10points
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
09-11-2002 05:45 AM
09-11-2002 05:45 AM
I need to do "ifconfig lan0 | grep inet" and from the line I get I just get the IP address. i.e. pipe the output to something and get only the ip adress ??
ANY CLUES
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:48 AM
09-11-2002 05:48 AM
Re: Quick scripting 10points
For the quick and dirty way to get the IP address from something like this:
Try this:
# ifconfig lan0
lan0: flags=843
inet 10.100.12.23 netmask ffffff00 broadcast 10.100.12.255
# ifconfig lan0 | tail -1 | awk '{print $2}'
10.100.12.23
It may not work in all cases, but it is one way to do it.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:49 AM
09-11-2002 05:49 AM
Re: Quick scripting 10points
try
ifconfig lan0 | grep inet | cut -s -d " " -f2
regards
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:50 AM
09-11-2002 05:50 AM
Re: Quick scripting 10points
ifconfig lan0 | grep inet | awk '{print $2}'
will give you the IP adress only .
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:52 AM
09-11-2002 05:52 AM
Re: Quick scripting 10points
do the following
ifconfig lan0 | grep inet | awk '{print $2}'
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:53 AM
09-11-2002 05:53 AM
Re: Quick scripting 10points
OK 10 points to all...
Good day to all
Stefan
CASE CLOSED
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:54 AM
09-11-2002 05:54 AM
Re: Quick scripting 10points
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:54 AM
09-11-2002 05:54 AM
Re: Quick scripting 10points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:57 AM
09-11-2002 05:57 AM
Re: Quick scripting 10points
try this
ip1=`ifconfig lan0 | grep inet | awk '{print $2}'`
echo $ip1
will give the ip address stored in a variable
hth,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 05:58 AM
09-11-2002 05:58 AM
Re: Quick scripting 10points
ifconfig lan0 | perl -n -e 'if (/inet ([\d.]*) netmask/) {print $1;}'
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 06:16 AM
09-11-2002 06:16 AM
Re: Quick scripting 10points
Why on earth waste two processes with IPC involved where just one would suffice?
e.g.
# ifconfig lan0 | awk '$1~/inet/{print $2}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2002 06:22 AM
09-11-2002 06:22 AM
Re: Quick scripting 10points
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2002 05:04 AM
09-12-2002 05:04 AM