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