#!/usr/bin/perl -w use warnings; use strict; my $host_re = qr/(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)/; print "^ Date ^ Destinataire ^ Serveur distant ^ Adresse serveur distant ^ Statut ^ Message remise ^\n"; while (){ next unless $_ =~ m/^(.+\.?\s\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2})\s($host_re)\spostfix\/smtp\[\d+\]:\s\w+:\sto=<(.*)>,\srelay=($host_re)\[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]:\d+,\sdelay=\d+(\.\d+)?,\sdelays=.*,\sdsn=.*,\sstatus=(\w+)\s\((.*)\)/; print "| $1 | $3 | $4 | $5 | $7 | $8 |\n"; }