Hi all,

I hope I could get some help with AWK.

What I need to achieve is counting all domains in an e-mail log file. The values are in field 7 ($7), and I need to count each domain separately.

This is what I have so far:

awk '$7=/@./ {som = som+1}; END {print som}' seip1_1_.log

But this results in counting 'all' the domains which appear behind the @.

I want this result:

@domain.com 22
@otherdomain.net 12
@somethingelse.org 5
@other.biz 3

Where the numbers are the amount of results of that domain. The AWK needs to be a oneliner.

I really hope someone can help me with this!

Thanks in advance!!

Sincerely yours,

S1GNZ

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.