home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / finger.sed < prev    next >
Text File  |  1989-03-04  |  2KB  |  52 lines

  1. Newsgroups: comp.sources.misc
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Subject: v06i044: Ridiculously fast&dirty finger "program"
  4. Keywords: Frogging fast finger.
  5. Sender: news%warwick.uucp@NSS.Cs.Ucl.AC.UK
  6. Reply-To: Mike Taylor <mirk%cs.warwick.ac.uk@NSS.Cs.Ucl.AC.UK>
  7. Followup-To: comp.unix.questions
  8. Organization: Computer Science, Warwick University, UK
  9.  
  10. Posting-number: Volume 6, Issue 44
  11. Submitted-by: @SRI-NIC.ARPA,@NSS.Cs.Ucl.AC.UK,@cu.warwick.ac.uk:news@warwick.UUCP
  12. Archive-name: finger.sed
  13.  
  14.  
  15. Hi guys - while learning to use sed(1), I found myself with an
  16. inescapable urge to write a version of finger that just seds a line of
  17. the password file.  Here's the result: it runs *very* quickly, and
  18. obviously doesn't quite as much information as a "real" finger - but
  19. in the average, work-a-day drudgery, of tidal-waves and such-like,
  20. I reckon I'll shoot for the speed any day of the week.
  21.  
  22. If you don't use the yellow pages password system, then replace the
  23. "ypmatch \!:* passwd" with an "egrep \!:* /etc/passwd": If you *do*
  24. use yp, then this won't work for uid's in the password *file*.  If
  25. anyone has an elegant way around this,then please post followup to
  26. comp.unix.questions - I tried stuff like:
  27.  
  28.     ( ypmatch \!:* passwd ) >& /dev/null || egrep root /etc/passwd
  29.  
  30. But this is stricken by the dreaded and cruddy csh(1) feature that
  31. redirects standard output along with standard error when you use ">&"
  32. Grrr!  Unkle Mirk flames the csh-designers for this piece of stupidity.
  33.  
  34. Anyway, here is the alias: obviously, it won't work with Bourne shell,
  35. which doesn't support aliases.  It should work with all C-shells, I
  36. think, and I have no idea about ksh.  Enjoy!
  37.  
  38. /*--------------------------------------------------------------------------*/
  39.  
  40. alias yff "ypmatch \!:* passwd | sed 's/\([^:]*\):\([^:]*\):\([^:]*\):\([^:]*\):\([^,]*\)[^:]*:\([^:]*\):\([^:]*\)/Login name:     \1\\\
  41. Real name:      \5\\\
  42. Home directory: \6\\\
  43. Shell:          \7\\\
  44. Passwd:         \2\\\
  45. (uid,gid):      (\3,\4)\\\
  46. /'"
  47. ______________________________________________________________________________
  48. Mike Taylor - {Christ,M{athemat,us}ic}ian ...  Email to: mirk@uk.ac.warwick.cs
  49. Unkle Mirk sez: "You fritter and waste the hours in an offhand waistcoat." :-)
  50. ------------------------------------------------------------------------------
  51.  
  52.