Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
grep for ip address
# This is a function so, source me in.
# really basic grep function to find IP/netmask octets.
function ipgrep()
# find any pattern from "" to ""
# TODO fix this so it checks for legal octets ( (Note: may be some time)
grep -o -E '\b(((2[0-5]|1[0-9])|[0-9])?([0-9]){1,2}\.){3}((2[0-5]|1[0-9])|[0-9])?([0-9])\b'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment