It might be fun to write regular expressions but it's also reinventing the wheel. Regular expressions for IPs can be found in Regexp::Common.
perl -MRegexp::Common='net' -n -e 'm/$RE{net}{IPv4}{-keep}/ && print "xxx.xx.xx.$5\n"'In reply to Re: Filtering out IP addresses
by 1s44c
in thread Filtering out IP addresses
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |