home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / finger.sed < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  2.5 KB

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