Question about output to file

Hi,

I am try to setup a FOR loop script to find out all the existing linux workstations in the network w/ ip address, hostname and linux version.

I created a basic FOR loop script:

for i in $(seq 1 254)
do
echo 10.72.169.$i >> result
ssh -o ConnectTimeout=3 root@10.72.169.$i "hostname" >> result
ssh -o ConnectTimeout=3 root@10.72.169.$i "cat /etc/redhat-release" >> result
done

However, the output is like this:

.
.
10.72.169.21
lumines.devo.ilx.com
Fedora Core release 5 (Bordeaux)
10.72.169.22
10.72.169.23
10.72.169.24
copper.devo.ilx.com
10.72.169.25
frogger.devo.ilx.com
Fedora Core release 5 (Bordeaux)
10.72.169.26
afterlife.devo.ilx.com
Red Hat Linux release 9 (Shrike)
10.72.169.27
10.72.169.28
molybdenum
Red Hat Linux release 9 (Shrike)
10.72.169.29
Red Hat Linux release 7.2 (Enigma)
10.72.169.30
.
.
.

I want the output to be like (with ip address, then hostname, then version) :

10.72.169.21 lumines.devo.ilx.com Fedora Core release 5 (Bordeaux)
10.72.169.22 abc.devo.ilx.com Fedora Core release 5 (Bordeaux)
.
.

I think with the command AWK, i don't know how to do that. Can someone show it to me?

Thanks
BEELOO

It's against the:

to double posts questions, continue here:

Thread closed.