At Thu, 11 Jul 2002 11:52:23 +1000 (EST), Matthew Palmer wrote:
> On Thu, 11 Jul 2002, Simon Bryan wrote:
> > I am looking for a way to pipe the members of a particular group on a RH7.2
> > system to a file. Is there such a command, or at least the list members
> > command?
> Something like this will work:
>   grep groupname /etc/group | cut -d : -f 4 | sed s/,/ /
> That'll give you the group members as a space separated list.
> 
> Won't work if groups are in NIS, LDAP, or similar.

which is why you use getent(1), not read the files directly!

 getent group groupname | sed 's/^.*://; y/,/ /'

-- 
 - Gus
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to