#!/usr/local/bin/perl -w # # tcprange # # Usage: tcprange ) { next if /^#/; /^([^\@:]+\@)?([\d\.\-]*)?:(.*)$/ or die "Illegal line: $_"; ($info,$ip,$rule)=($1,$2,$3); unless ( $ip =~ /-/ ) { print; next; } # is `!!' ok? $ip =~ s/(\d{1,3})-(\d{1,3})/!!/ or die "Illegal line: $_"; ($start,$stop)=($1,$2); foreach $iter ( $start .. $stop ) { my($iterip)=$ip; $iterip =~ s/!!/$iter/; # `!!' ? $^W=0; # $info and $rule might be undef print "$info$iterip:$rule\n"; $^W=1; } } .