YP answer (was Re: awk and shell question)

Richard O'Keefe ok at cs.mu.oz.au
Tue Sep 19 19:45:29 AEST 1989


In article <124894 at sun.Eng.Sun.COM>, limes at ouroborous.Eng.Sun.COM (MIDI Apprentice) writes:
: In article <2130 at munnari.oz.au> ok at cs.mu.oz.au (Richard O'Keefe) writes:
: >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 grovelling through it with grep, the following will
: probably be somewhat faster (my passwd map is around 2500 entries):
: 	ypmatch $LOGNAME passwd | cut -f5 -d:

My point was to _beware_ of Yellow Pages.
The manual page says of ypmatch that "No pattern matching is available".
If you're looking for an exact match, ypmatch is fine.  For anything else,
ypcat | grep is the way to go.



More information about the Comp.unix.wizards mailing list