Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need script for ip address resolution

Status
Not open for further replies.

mragain

IS-IT--Management
Oct 10, 2002
32
0
0
US
I have a file with a list of sites like:

.playboy.com
.myspace.com
.etc.com

I want to read each line in the file resolve its ip address and write the ip address that is returned into a another file.

Any help will be greatly appreciate.

 
man nslookup

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I have been looking at nslookup, but I was hoping there was a switch I could pass in that would strip out everything from the response except the servers IP address. The man pages have helped me in getting close to the output I wanted, but still returns more information than I wanted.

thanks
 
man grep

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I found the answer in a combination of host and awk:

host -t a google.com | awk '{print($4)}'

appreciate your time and comments.

 
Would like to replace all instances of "|" (pipe symbol) with a newline in text file so that


becomes




Tried

sed 's/|/\n/' < $input.txt > $output.txt

which didn't work. I'm sure it's my limited knowledge of all things regex that's standing in my way.

Regex school is hard! (but worth it)

TIA!

maurie

P.S. I'm trying to convert the output of "Use current pages" in firefox to save the current tabs I have open. I have a tendency to open a bazillion tabs at once and I periodically do a "dump" of what is open just in case firefox crashes. I do use TabMix Plus which is an incredible extension but this way I push my scrtiping knowledge a little further. My goal is to put together a local version of a tagged bookmark file, ala del.icio.us, again learning along the way.
 
DOH!!!

Sorry!

Filled this out in the wrong place. Guess I need more caffeine.

Again my apologies


maurie
 
Pls don't 'piggy-back' posts - start a new thread for any unrelated questions.

'man tr'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
You may try something like this:
awk '{gsub(/|/,"\n");print}' $input.txt > $output.txt

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, PHV!

And, again, sorry, vlad!!! I was asleep at the wheel here and placed my new post where a reply belonged. Apparently too much blood in my caffeine system today.

maurie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top