grep "whitelist addition" maillog.txt | grep "my expression" | cut -d \> -f 1 | cut 33- > rlist
What does it do?
- It finds all the "whitelist additions" in maillog.txt
- For all of those, it searches for "my expression" to further limit what I'm searching
- It then
cut
s the resulting line off at the > delimiter. - Then, it grabs the email address after position 33
- and dumps it into rlist
I probably *should* have used awk to do this, but I didn't have it, and this is the ugly way to get the email list that I wanted. Arguably, I could have used
cut -d \< -f 2
instead of the cut 33-
but there you have it.Edited to add: actually, the latter option is better/more flexible. I'd suggest that in the future.
Further edited to add:
grep "whitelist addition" maillog.txt | grep -v "localdomain.com"
This shows me all whitelists that my server made that were based upon bounces (contact-forwards, usually), not from true outbound from local users.
No comments:
Post a Comment