Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Created August 25, 2014 22:18
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 shichao-an/60cbd5efedfabc4c14bd to your computer and use it in GitHub Desktop.
Save shichao-an/60cbd5efedfabc4c14bd to your computer and use it in GitHub Desktop.
Print LAN nodes
#!/bin/bash
# Works on OS X
ping -c 2 -i 2 255.255.255.255 | awk ' $4 ~ /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/{print $4}' \
| sed 's/\(.*\):/\1/g' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment