Skip to content

Instantly share code, notes, and snippets.

@hackingbutlegal
Created August 24, 2015 21:12
Show Gist options
  • Save hackingbutlegal/cf4ed2601b7b0fef8157 to your computer and use it in GitHub Desktop.
Save hackingbutlegal/cf4ed2601b7b0fef8157 to your computer and use it in GitHub Desktop.
Regex to match on only valid IPs including local and bcast
grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' file.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment