Hi List, I have following regex:
echo "1: 192.168.0.180:32866 - 192.168.0.183:143 (a2b) 17> 14< (complete)" | perl -lane 'print$_;if($_ =~ /(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5}) - (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):(\d{1,5})/) {print "Source IP = $1, Source Port = $2, Destinatin IP = $3, Destination Port = $4\n"}'
which prints the first and second IP/Port. Output is Source IP = 192.168.0.180, Source Port = 32866, Destinatin IP = 192.168.0.183, Destination Port = 143
Can somebody suggest compact regex to achieve the same. Thanks and Regards, Manish
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>