I made a solution. I'm posting it here because I really think others will want this. Also, do you have another way of doing this? Please share!
Edit: I have been informed this is not yet suitable for use on BSD.
#!/bin/bash
#
# Checks which hosts in your /etc/hosts file are up or down
#
# Author: Tom Dignan <tom.dignan@gmail.com>
#
# Contributors:
# - Janne Pikkarainen, grep optimization
# - Andy Lee Robinson, awk suggestion
ENABLE_IPV6=true
GREEN="\033[0;32m"
RED="\033[0;31m"
RESET="\033[0m"
#ipv4
grep -Ev '(^[#$]|::)' /etc/hosts | tr '\t' ' ' | \
cut -d ' ' -f1 | xargs -I@ echo ping -W2 -c1 @ '&>/dev/null' '&&' echo -e @ \
"\"[${GREEN}OK${RESET}]\"" '||' echo -e @ "\"[${RED}DOWN${RESET}]\"" | bash | awk '{ printf "%-22s %s\n", $1, $2 }'
if [ $ENABLE_IPV6 == true ]
then
#ipv6
grep "::" /etc/hosts | grep -v "^$" | tr '\t' ' ' | \
cut -d ' ' -f1 | xargs -I@ echo ping6 -W2 -c1 @ '&>/dev/null' '&&' echo -e @ \
"\"[${GREEN}OK${RESET}]\"" '||' echo -e @ "\"[${RED}DOWN${RESET}]\"" \
| bash | awk '{ printf "%-22s %s\n", $1, $2 }'
fi
Now available on github, fork it here.