while () { next unless index '%SEC-6-IPACCESSLOG', $_; @f = split /(?:[:,]*\s+:?|\/)/; print join($/, @f), $/; } __DATA__ Aug 22 11:46:27 masterudp003210uds.netops.msnyuhealth.org 148526: Aug 22 15:46:26 UTC: %SEC-6-IPACCESSLOGDP: list 101 denied icmp 10.4.12.2 53 -> 10.7.151.48 :8/0:, 1 packet