-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Jul 06, 2004 at 12:39:38PM -0400, Scot L. Harris wrote: > On Tue, 2004-07-06 at 12:17, Matt Brodeur wrote: > > > > $ awk -v FS=':' '/^GROUPNAME/ { print $4 }' /etc/group > > why not: > > grep groupname /etc/group > > Replace groupname by the name of the group you are looking for. Because I wanted to be clever, that's why. ;) What my command is doing is searching for a line starting with the group name, then printing the fourth colon-delimited field. The net effect is that you get a comma separated list of the users in the group, and nothing else. It's functionally equivalent to this: $ grep '^GROUPNAME' /etc/group | cut -f4 -d':' This could be improved by changing the search expression to this: '^GROUPNAME\:' ...so that you would avoid the case where you're searching for a group name that's part of another name (eg, web vs. webmaster). If you were to leave out the caret and the colon you'd match on both the group you're looking for AND any group with a member by the same name. A quick check on this system shows that "mbrodeur" appears on seven lines of the group file, once for the "mbrodeur" group, and in six other groups that I'm a member of. - -- Matt Brodeur RHCE MBrodeur@xxxxxxxxxxxx http://www.NextTime.com Political T.V. commercials prove one thing: some candidates can tell all their good points and qualifications in just 30 seconds. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQFA6uZBc8/WFSz+GKMRApOsAKCjKCQw7NFwSE4wal/uDyc1+viCfQCfQ1HH KLG3bqXYR8bCcBg53qY2qTE= =3aT3 -----END PGP SIGNATURE----- -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list