I am currenlty trying to extract all the sender domains from maillog
. I am able to do some of that with the below command but the output is not quite what I desired. What would be the best approach to retrieve a unique list of sender domain from maillog?
grep from= /var/log/maillog | awk '{print $7}' | sort | uniq -c | sort -n
output
1 from=<user@test.com>,
1 from=<apache@app1.com>,
2 from=<bounceld_5BFa-bx0p-P3tQ-67Nn@example.com>,
2 from=<bounceld_19iI-HqaS-usVU-fqe5@example.com>,
12 reject:
666 from=<>,
desired output
test.com
app1.com
example.com