home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10449 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.4 KB  |  30 lines

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