LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-20-2010, 08:23 AM   #1
hussain.s
LQ Newbie
 
Registered: Oct 2010
Posts: 9

Rep: Reputation: 0
how to get only ip address of host


hi,
my problem is when iam typing


a=host test.com
echo $a


output
test.com has address 17.108.43.86

now i want to print only address (17.108.43.86) and don't want to print this line [test.com has address] how to do this
 
Old 10-20-2010, 08:46 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,922
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Hi,

Sure looks like 'homework' to me.

Maybe you should review the LQ Rules;
Quote:
Do not expect LQ members to do your homework - you will learn much more by doing it yourself.
Start out at items 4, 5 and 6 below.

Just a few links to aid you to gaining some understanding;

1. Linux Documentation Project
2. Rute Tutorial & Exposition
3. Linux Command Guide
4. Bash Beginners Guide
5. Bash Reference Manual
6. Advanced Bash-Scripting Guide
7. Linux Newbie Admin Guide
8. LinuxSelfHelp
9. Getting Started with Linux



The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

Last edited by onebuck; 10-20-2010 at 08:56 AM. Reason: correct numerical link list
 
Old 10-20-2010, 08:52 AM   #3
hairysocks
Member
 
Registered: May 2002
Location: Thorverton, Near Exeter, Devon, England
Distribution: Ubuntu 10.04 (used to be Red Hat 7.1, then Red Hat 9, then FC 2, FC 5, FC 6, FC 9 and Ubuntu 8.04)
Posts: 105

Rep: Reputation: 16
I won't give the full solution (because it does look like homework), but try the "read" command on the output from "host" in a script.
 
Old 10-22-2010, 05:06 AM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the ip address of host in linux with using of host and nslookup command hussain.s Linux - General 4 10-23-2010 09:12 PM
some other host already uses address josephmo Linux - Networking 10 10-19-2010 02:08 AM
Can ssh into host on lan using WLAN address, but not through LAN address gurkakrieg Slackware 4 01-05-2010 07:19 AM
How can I get the ip address of my host system dwijesh Linux - Newbie 3 04-27-2009 04:53 AM
eth0 and host address tommytomato Linux - Newbie 2 12-03-2003 04:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration