#!/usr/bin/perl while () { # Only match lines that have a " to=" in them. # The leading space is important because many # lines have a "proto=" if (/ to=/) { #($to_addr = $_) =~ s/.* to=([^,]+), .*/$1/; ($to_addr = $_) =~ s/.* to=(.+?), .*/$1/; print "$to_addr"; } }