![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
The outfile still very messy.
It looks like this: 10.72.169.110.72.169.210.72.169.310.72.169.410.72.169.510.72.169.610.72.169.710.72.169.810.72.169.91 0.72.169.1010.72.169.1110.72.169.1210.72.169.13datafeeds Red Hat Enterprise Linux AS release 3 (Taroon) 10.72.169.1410.72.169.1510.72.169.16xenon.devo.ilx.com Fedora Core release 5 (Bordeaux) 10.72.169.1710.72.169.1810.72.169.1910.72.169.2010.72.169.21lumines.devo.ilx.com Fedora Core release 5 (Bordeaux) 10.72.169.2210.72.169.2310.72.169.24 However, someone of ip address maybe dead or no one using it. Does it make any different? |
| Forum Sponsor | ||
|
|
|
|||
|
You could also put the IP address inside the ssh command; then you don't get any output from hosts which don't respond.
Code:
for i in $(seq 1 254)
do
ssh -o ConnectTimeout=3 root@10.72.169.$i "echo 10.72.169.$i `hostname` `cat /etc/redhat-release`"
done >result
|
|
|||
|
I want the host ip to show up even though the ip isn't being used or dead, so i used the below script and now it only turns all numbers in single line...
for i in $(seq 1 254) do echo -n 10.72.169.$i >> result2 ssh -o ConnectTimeout=3 root@10.72.169.$i "hostname; cat /etc/redhat-release'" >> result2 done RESULT: 10.72.169.110.72.169.210.72.169.310.72.169.410.72.169.510.72.169.610.72.169.710.72.169.810.72.169.91 0.72.169.1010.72.169.1110.72.169.1210.72.169.1310.72.169.1410.72.169.1510.72.169.1610.72.169.1710.72 .169.1810.72.169.1910.72.169.2010.72.169.2110.72.169.2210.72.169.2310.72.169.24 |