#!/bin/sh # # /usr/local/sbin/localshowmailreceivedfromdomain # Copyright 2007 Jonas Smedegaard # # $Id: localshowmailreceivedfromdomain,v 1.3 2007-09-27 21:43:37 jonas Exp $ # # List emails recently received from a certain domain # # TODO: Handle other indicatiors than AMaViS # logfiles="${logfiles:-1}" find /var/log -name 'mail.log*' | sort -nr -t. -k3 | tail -n "$logfiles" | xargs zcat -f \ | egrep -- '@'"$1"'> -> ' \ | sed 's/^\(.\{15\}\) [^)]*) \([^,]*\), [^]]*] \([^ ]*\) -> .*Message-ID: \([^>,]*>\?\).*/\1 \3 (\4) \2/'