in reply to Using unix commands in perl?
This displays the source ip, port, destination ip and portopen(file_info,$file) or die "Can't open $file "; while (<file_info>) { my ( $src_ip, $src_port ) = /IP\s+(\d+(?:\.\d+){3})\.(\d+)/; my ( $dst_ip, $dst_port ) = />\s+(\d+(?:\.\d+){3})\.(\d+)/; print "$src_ip , $src_port , $dst_ip , $dst_port \n" ; } close(file_info);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using unix commands in perl?
by erroneousBollock (Curate) on Oct 06, 2007 at 05:16 UTC |