summaryrefslogtreecommitdiff
path: root/localshowmailreceivedfromdomain
blob: d83f394dcd3dcbb9b0d5d52dd1f3c75fb0d71374 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localshowmailreceivedfromdomain
  4. # Copyright 2007 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localshowmailreceivedfromdomain,v 1.2 2007-09-15 02:06:16 jonas Exp $
  7. #
  8. # List emails recently received from a certain domain
  9. #
  10. # TODO: Handle other indicatiors than AMaViS
  11. #
  12. 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/'