I spent a while figuring out how to get a list of email recipient addresses from the maillog, without duplicates, for a specific day on RHEL.In the end I distilled it into to one line.
I'm sure I will have to do it again, so I'm making a note of it here, meantime if you need to extract recipient addresses from maillog you're welcome to try it. just paste it onto the command line and hit the go button, its surpisingly quick.
I'm sure I will have to do it again, so I'm making a note of it here, meantime if you need to extract recipient addresses from maillog you're welcome to try it. just paste it onto the command line and hit the go button, its surpisingly quick.
cat /var/log/maillog | grep "Oct 19" |\ grep to= |cut -f5 -d":" | cut -f2 -d"=" | cut -f1 -d"," | \ sed 's/<//' | sed 's/>//' | \ sort | uniq > addresses.txt