Skip to content

Instantly share code, notes, and snippets.

@yilas
Last active March 4, 2016 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yilas/bae086bfda2c2a3a722f to your computer and use it in GitHub Desktop.
Save yilas/bae086bfda2c2a3a722f to your computer and use it in GitHub Desktop.
## sed fichier /etc/hosts
sed -n '/HostsBegin/,/HostsEnd/p' /etc/hosts|\
egrep -v '^[[:space:]]*$|^#' |\
while read ipaddr hn x; do
if ! ping -c 2 -W 2 $ipaddr >/dev/null 2>&1; then
echo $ipaddr $hn unreachable
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment