Created
August 25, 2014 22:18
-
-
Save shichao-an/60cbd5efedfabc4c14bd to your computer and use it in GitHub Desktop.
Print LAN nodes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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