home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume6
/
finger.sed
< prev
next >
Wrap
Text File
|
1989-03-04
|
2KB
|
52 lines
Newsgroups: comp.sources.misc
From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
Subject: v06i044: Ridiculously fast&dirty finger "program"
Keywords: Frogging fast finger.
Sender: news%warwick.uucp@NSS.Cs.Ucl.AC.UK
Reply-To: Mike Taylor <mirk%cs.warwick.ac.uk@NSS.Cs.Ucl.AC.UK>
Followup-To: comp.unix.questions
Organization: Computer Science, Warwick University, UK
Posting-number: Volume 6, Issue 44
Submitted-by: @SRI-NIC.ARPA,@NSS.Cs.Ucl.AC.UK,@cu.warwick.ac.uk:news@warwick.UUCP
Archive-name: finger.sed
Hi guys - while learning to use sed(1), I found myself with an
inescapable urge to write a version of finger that just seds a line of
the password file. Here's the result: it runs *very* quickly, and
obviously doesn't quite as much information as a "real" finger - but
in the average, work-a-day drudgery, of tidal-waves and such-like,
I reckon I'll shoot for the speed any day of the week.
If you don't use the yellow pages password system, then replace the
"ypmatch \!:* passwd" with an "egrep \!:* /etc/passwd": If you *do*
use yp, then this won't work for uid's in the password *file*. If
anyone has an elegant way around this,then please post followup to
comp.unix.questions - I tried stuff like:
( ypmatch \!:* passwd ) >& /dev/null || egrep root /etc/passwd
But this is stricken by the dreaded and cruddy csh(1) feature that
redirects standard output along with standard error when you use ">&"
Grrr! Unkle Mirk flames the csh-designers for this piece of stupidity.
Anyway, here is the alias: obviously, it won't work with Bourne shell,
which doesn't support aliases. It should work with all C-shells, I
think, and I have no idea about ksh. Enjoy!
/*--------------------------------------------------------------------------*/
alias yff "ypmatch \!:* passwd | sed 's/\([^:]*\):\([^:]*\):\([^:]*\):\([^:]*\):\([^,]*\)[^:]*:\([^:]*\):\([^:]*\)/Login name: \1\\\
Real name: \5\\\
Home directory: \6\\\
Shell: \7\\\
Passwd: \2\\\
(uid,gid): (\3,\4)\\\
/'"
______________________________________________________________________________
Mike Taylor - {Christ,M{athemat,us}ic}ian ... Email to: mirk@uk.ac.warwick.cs
Unkle Mirk sez: "You fritter and waste the hours in an offhand waistcoat." :-)
------------------------------------------------------------------------------