in reply to Extracing (and excluding) IP's from a file

This works for the extract but still ends up including the IP addresses from vfiler0.
open (OUTDATA, ">> $vfile2"); open (GETDATA, "$vfile"); my $vfiler0 = 0; my $vfiler = 0; while(<GETDATA>) { chomp; if(/^\s*$/) { $vfiler = 0; } if(/vfiler0/) { $vfiler = 1; } if (!$vfiler && m/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1 +,3})/) { my $ip=$1; print OUTDATA "$ip\n"; } }
Current Output:
10.42.156.16 10.42.156.19 10.42.156.18 123.123.123.123 123.124.123.123 123.123.123.123 123.124.123.123
Thanks!

Replies are listed 'Best First'.
Re^2: Extracing (and excluding) IP's from a file
by sporesbash (Initiate) on Nov 09, 2010 at 14:14 UTC
    small syntax error, got it to work. Thanks Much!