Ping file with ip address

Hi,

If have a file with 93 ip address that i want to ping in first place (later i want to use this file for snmp output of those ip addresses).

First i want to do is to ping all those ip addresses. I know i can put for every ip address "ping" with the vi. But i want the keep this file clean and only ip addresses in it.

I now tried a several thing to ping all those ip addresses but nothing works, somebody any idea?

Underneath some things i've tried, i think they make no sense and are complete wrong:o

bash-2.03$ cat all_hosts_ip | while read
> do ping $line
>done

bash-2.03$ while $line ; do echo all_hosts_ip ; ping all_host_ip ; done

Take a look at the following input file and execution script. (I specifically call the ping command in my example.)

> cat ip_list
10.1.191.100
10.1.191.101
10.1.191.102
10.1.191.126

> cat auto_ping
#! /usr/bin/bash

while read ip_addr
   do
   echo $ip_addr
#   ping "$ip_addr"
   /usr/sbin/ping "$ip_addr" 10
done < ip_list
> 

Assuming you are running bash, here is the script:

for ipaddr in `cat ip_list`;
do
ping $ipaddr >> pingout &
done;

And then you can do 'tail -f pingout' to see the outputs of pings simultaneously. If you want outputs to be one after the other, you can remove the '&' at the end of the ping statement.

oo that will be nasty, starting 96 copies of ping which will all have to be explicitly killed!

why not:

while read IP;
do
ping -c 4 $IP >>output_file
done <input_file