awk '/^[0-9]/{print $1}' /etc/hosts |xargs -l ping -c 1 $1
或者:
awk '/^[^#]/ {system("ping -c 1 "$1)}' < /etc/hosts