#!/bin/bash [ ! -n "$1" ] && echo "Usage : $0 mail" && exit 1 for mail in $( mailq|egrep '^[A-Z0-9]'|grep "$1"|awk '{print $1}'|sed 's/^\([0-9A-Z]*\).*$/\1/' ) do /usr/sbin/postsuper -d $mail done