Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!sun-barr!newstop!sun!ouroborous.Eng.Sun.COM!limes From: limes@ouroborous.Eng.Sun.COM (MIDI Apprentice) Newsgroups: comp.unix.wizards Subject: YP answer (was Re: awk and shell question) Keywords: awk sh Message-ID: <124894@sun.Eng.Sun.COM> Date: 18 Sep 89 20:27:02 GMT References: <1163@ispi.UUCP> <2412@netcom.UUCP> <2130@munnari.oz.au> Sender: news@sun.Eng.Sun.COM Reply-To: limes@ouroborous.Sun.COM (Greg Limes) Organization: Sun Microsystems, Inc. Lines: 15 In article <2130@munnari.oz.au> ok@cs.mu.oz.au (Richard O'Keefe) writes: >In article <2412@netcom.UUCP>, hinton@netcom.UUCP (Greg Hinton) writes: >: In article <1163@ispi.UUCP> jbayer@ispi.UUCP (Jonathan Bayer) writes: >: >I have to get the user id, and then get the user description from /etc/passwd. >Again, watch out for Yellow Pages; if you're using that you have to do > ypcat passwd | grep "^${LOGNAME}" | what-ever-you-want-here Assuming that a YP lookup operation is more efficient then doing a YP database dump and groveling through it with grep, the following will probably be somewhat faster (my passwd map is around 2500 entries): ypmatch $LOGNAME passwd | cut -f5 -d: Add error checking [and salt] to taste. -- Greg Limes limes@sun.com ...!sun!limes 73327,2473 [choose one]