home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!pbhya!dbsuthe
- From: dbsuthe@pbhya.PacBell.COM (Daniel B. Suthers)
- Subject: Re: I want a program that prints out base gid's of any user
- Reply-To: dbsuthe@PacBell.COM (Daniel B. Suthers)
- Organization: Pacific * Bell, San Ramon, CA
- Date: Thu, 27 Aug 1992 23:17:03 GMT
- Message-ID: <1992Aug27.231703.17793@pbhya.PacBell.COM>
- References: <BtIqyp.F5A@news.cso.uiuc.edu> <15360003@hprpcd.rose.hp.com>
- Lines: 18
-
- In article <15360003@hprpcd.rose.hp.com> tmilner@hprpcd.rose.hp.com (Tom Milner) writes:
- >In comp.unix.questions, bzg52408@uxa.cso.uiuc.edu (Benjamin Z. Goldsteen) writes:
- >
- >
- >| I have been trying to write a program that prints out the
- >| base gid of a user (given on the command line). I have tried
- >| using awk and perl, but I can not get anything decent.
-
- The following shell script should work in a resonably portable and robust way:
- GRPNO=`grep "^$1:" /etc/passwd | cut -f4 -d:` &&
- sed -n "s/^\(.*\):.*:$GRPNO:.*/\1/"p /etc/group
-
- Daniel B. Suthers, CCP
- Technology Consultant, PCS & IN Development Lab, Pac*Bell
- Voice: (510) 671-1325 UUCP: dbsuthe@Pacbell.COM
- ================================================================================
- = Commit unexpected kindnesses and senseless acts of beauty. =
- ================================================================================
-