Assuming your using a bash shell,
I would recommend a simpler for loop
If you already have the list as a string variable (separated by spaces tabs, or newlines)
(SERVERLIST="server1 server2 server3") just put
Quote:
for SERVER in ${SERVERLIST}
do
cat serverlist | grep "${SERVER}" >> output_file
done
|
If the list of servers going down comes as a file, use
Quote:
for SERVER in $(cat downed_servers_file)
do
cat serverlist | grep "${SERVER}" >> output_file
done
|