in reply to Extracing (and excluding) IP's from a file
You haven written curly brackets instead of round brackets to capture the match into "$1".
For excluding "vfiler0" block you'll have to identify where new block begins. It may be a blank line.
... my $vfiler0 = 0; while(<FaH>) { chomp; if(/^\s*$/) { $vfiler = 0; } if(/vfiler0/) { $vifiler = 1; } if (!$vfiler && m/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/) { $ip=$1; print FaHout "$ip\n"; } } ...
|
|---|