[CentOS] Shell script to list group members

Tim Alberts talberts at msiscales.com
Tue Sep 23 23:51:25 UTC 2008


Bob Beers wrote:
> On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer <lists at brimer.org> wrote:
>   
>> 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'
>>
>>     
>
>
> ok, Barry wins. :)
>
> But, I don't think you need the egrep ...
>
> getent group groupname | ...
>
> works ok for me.
>
> -Bob

Excellent, 'getent group...' should do perfectly.  Thanks Barry and Bob.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: talberts.vcf
Type: text/x-vcard
Size: 337 bytes
Desc: not available
Url : http://lists.centos.org/pipermail/centos/attachments/20080923/d0c17202/talberts.vcf


More information about the CentOS mailing list