in reply to Regex to take an ip address before a comma
What moritz said. This would be a start, which you might need to tweak based on any unmentioned requirements:
use Regexp::Common qw(net); while (<>) { my ($keeper) = $_ =~ / ($RE{net}{IPv4}) # Capture the IP , # comma /x; printf "%s\n", $keeper if $keeper; }
|
|---|