in reply to Handling output from nslookup and ping

Just a word of warning when groking output from commandline ping...it's output is SUPER buffered, which means you won't necessarily catch anything until you flush the output. I had to use an expect script to unbuffer ping's output <before> catching it.
#!/usr/bin/expect -- # Description: unbuffer stdout of a program # Author: Don Libes, NIST eval spawn -noecho $argv set timeout -1 expect
Call the above using unbuffer <command> Hope this keeps you out of the trap I fell into!