#!/bin/sh # # /usr/local/sbin/localshowmailreceivedfromdomain # Copyright 2007 Jonas Smedegaard # # $Id: localshowmailreceivedfromdomain,v 1.2 2007-09-15 02:06:16 jonas Exp $ # # List emails recently received from a certain domain # # TODO: Handle other indicatiors than AMaViS # 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/'