Re: Shell script to list group members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Quoting Tim Alberts <talberts@xxxxxxxxxxxxx>:

> Barry Brimer wrote:
> > With spaces separating groups:
> >
> > egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
> /g'
> >
> > With commas separating groups:
> >
> > egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }'
>
> I'm sorry, I didn't specify, I'm using LDAP for user/group management.
> Ideally a command like 'groups' would be nice, except it would be the
> inverse, it would print the users in a group, not the groups a user
> belongs to.

With commas separating groups:

getent group | egrep -i '^groupname:' | awk -F : '{ print $4}'

With spaces separating groups:

getent group | egrep -i '^groupname:' | awk -F : '{ print $4}' | sed -e 's/,/
/g'


_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux