split problem

taa0 at cris.com taa0 at cris.com
Wed Jul 5 01:11:50 CDT 2000


Skipped content of type multipart/alternative-------------- next part --------------
#!/usr/local/bin/perl -w

my($id,$interval,$transfer,$bandwidth);

while(<DATA>) {

	undef $id; undef $interval; undef $transfer; undef $bandwidth;

	/\[\s*(ID)\]\s*(Interval)\s*(Transfer)\s*(Bandwidth)/
	&& do { $id = $1; $interval = $2; $transfer = $3; $bandwidth = $4; };

	/\[\s*([0-9]*)\]\s*([^\s]*\s*sec)\s*([^\s]*\s*MBytes)\s*([^\s]*\s*Mbits\/sec)/
	&& do { $id = $1; $interval = $2; $transfer = $3; $bandwidth = $4; };

	print "id=<$id> interval=<$interval> transfer=<$transfer> bandwidth=<$bandwidth>\n";

}
__END__
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-25.0 sec   188 MBytes  60.2 Mbits/sec
[  6]  0.0-25.0 sec   277 MBytes  88.5 Mbits/sec
[  5]  0.0-25.0 sec   112 MBytes  35.7 Mbits/sec
[  3]  0.0-25.0 sec   195 MBytes  62.4 Mbits/sec
[  5] 25.0-50.0 sec   196 MBytes  62.7 Mbits/sec


More information about the San-Diego-pm mailing list