perl -nwle" if(push( @s, $_ ) > 4 ){ shift @s } qq[@s]=~m[.+from (\S+).+identity ('[^']+').+verification failed]s and print qq[$1:$2]" junk.dat