Is there an easy way to get a list of users who are in all specified groups?
For example, if I have the following users:
| user name | membership in groups |
|---|---|
fred |
rainbow, dell |
jane |
hp |
zippy |
rainbow, hp, dell |
george |
hp, dell |
bungle |
rainbow, hp, dell |
I would like something like this:
[me@box ~]$ magic "dell,hp"
zippy, george, bungle
i. e. returning the users who are a member of both groups dell and hp.
If it is multiple steps that is fine, though if it’s not really possible without having to resort to lots of Bash black magic, and it is quicker to do it in a regular expression‐enabled text editor that is also fine.
I’m running on Red Hat Enterprise Linux 4 if that makes any difference.