Results 1 to 3 of 3
Hi,
I have been looking around for a good tutorial when using "for"
i would like to use it to use a list of hostname "hosts.txt" and have it go ...
- 07-26-2011 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 5
using for command to resolve list of hostname to ip
Hi,
I have been looking around for a good tutorial when using "for"
i would like to use it to use a list of hostname "hosts.txt" and have it go through the list, using "host <server.my.com> and then output the data to a file.
any hints on how to correctly get this working for me is appreciated.
i was hoping to use:
for variable in hosts.txt
do
host
done
how doe the variable get defined though? and is this the proper way? : )
thanks!
my hosts.txt file is basically:
server1.my.com
server2.my.com
etc...
- 07-26-2011 #2Code:
for NODE in $(cat hosts.txt); do host ${NODE};doneYou must always face the curtain with a bow.
- 07-26-2011 #3
If hosts.txt contains a large amount of hosts, then you might want to replace the for loop with parallel: Build and execute shell command lines from standard input in parallel
You must always face the curtain with a bow.


Reply With Quote