If you would like to strip this information down to the user's domains only without the output from the entire line (not to mention, if a subdomain has addon in it, then you'll get that if you don't refine the grep):
Code:
#grep "=addon" /etc/userdatadomains | awk {'print $1,$2'} | cut -d= -f1 | uniq -c | sort -n
1 addon.com: myuser
1 addon2.com: myuser
This represents two addon domains (addon.com and addon2.com owned by the user myuser).
Without the = portion, I was getting the following:
Code:
#grep "addon" /etc/userdatadomains | awk {'print $1,$2'} | cut -d= -f1 | uniq -c | sort -n
1 addon.com: myuser
1 addon.domain.com: myuser
1 addon2.com: myuser
That's because addon.domain.com has addon in the name even though it's a subdomain. Unless you also want subdomains, you'd want to use "=addon" in the grep.
Next, if you simply want to count the addon domains for a user without listing the domain names individually:
Code:
#grep "=addon" /etc/userdatadomains | awk {'print $2'} | cut -d= -f1 | uniq -c | sort -n
2 myuser
This outputs the count of the two addon domains that myuser owns.