egrep valid ip address

Example to egrep valid ip address

To egrep all valid ip addresses in current directory:

egrep -r '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}' .

An Alternative:

/bin/egrep '\b(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]?)\b'

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.