Last active
December 23, 2019 15:06
-
-
Save kosztik/582728386ff462eaff7e0e24adf016d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Use: email-i.sh /var/log/mail.info <from/to pattern> | |
# Used with postfix | |
if [[ $1 =~ gz ]]; then | |
cat="zcat" | |
else | |
cat="cat" | |
fi | |
id=`$cat $1| grep $2|grep -o "Queue-ID: *.........."|cut -d' ' -f2` | |
for i in $id | |
do | |
#cat /var/log/mail.info| grep $i| grep --color from| awk '{ print $0 }' | |
#cat /var/log/mail.info| grep $i| grep --color spam| awk '{ print $0 }' | |
$cat $1| grep $i| awk '{ print $0 }' | |
echo ======================================================================================== | |
echo ======================================================================================== | |
echo ======================================================================================== | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment