Mailing List
Home
Forum Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Installation - Getting started with Red Hat Linux
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
command to list all members of a group?

command to list all members of a group?

2004-07-06       - By Matt Brodeur

 Back
Reply:     1     2     3     4     5  

-- --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@(protected)                                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@(protected)
https://www.redhat.com/mailman/listinfo/shrike-list

Earn $52 per hosting referral at Lunarpages.