Skip to content

Instantly share code, notes, and snippets.

@dwallraff
Last active May 9, 2017 18:26
Show Gist options
  • Save dwallraff/d4076117912a3f343b305a3a3fcd1ae5 to your computer and use it in GitHub Desktop.
Save dwallraff/d4076117912a3f343b305a3a3fcd1ae5 to your computer and use it in GitHub Desktop.
Grep for valid ip address
grep -oE "(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
# for 0.0.0.0 to 999.999.999.999
# grep -oE "([0-9]{1,3}[\.]){3}[0-9]{1,3}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment