home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / mail / mh / 1279 < prev    next >
Encoding:
Text File  |  1992-11-12  |  2.3 KB  |  71 lines

  1. Newsgroups: comp.mail.mh
  2. Path: sparky!uunet!utcsri!torn!utzoo!utdoe!torag!jrh!jrh
  3. From: jrh@jrh.uucp (James R. Hamilton)
  4. Subject: Compact Folders Display
  5. Message-ID: <1992Nov12.023922.127025@jrh.uucp>
  6. Organization: private system, Toronto, Ontario
  7. Date: Thu, 12 Nov 1992 02:39:22 GMT
  8. Lines: 61
  9.  
  10.     On some of my accounts I have more MH folders than fit on a screen
  11.     at one time.  I like to be able to see them all at once so I've
  12.     written a small program that displays 4 on a line in the following
  13.     format:
  14.  
  15.                   folder:x>y
  16.  
  17.     where "folder" is the folder name, x is the number of messages in
  18.     the folder and y is the current message number.  If folder is the
  19.     current folder then it has a trailing "+" sign.  Some example output:
  20.  
  21.  
  22. archive:0        bdb:32>5        code:24>18        db:1>?
  23. drafts:0        eval:13>9        faq:28>20        inbox+:1>?
  24. jrh:3>?            logan:33>31        mh:8>7            notes:13>5
  25. ora:7>?            outbox:29>19    rbaker:3>3        uworld:3>1
  26.  
  27.     The program:
  28.  
  29. #!/bin/sh
  30. #---------------------------------------------------------------------------
  31. #
  32. #            FILE:    mhfolders
  33. #            Author:    James R. Hamilton
  34. #            Date:    92.10.04 @ 20:27:38
  35. #
  36. # USAGE: mhfolders
  37. #
  38. # DESCRIPTION: Prints out list of mhfolders and the number of messages in
  39. #              in each in a compact 4 column format.
  40. #
  41. # COMMENTS/FIXES TO: James Hamilton <jrh@jrh.gts.org>
  42. #---------------------------------------------------------------------------
  43.  
  44. AWK=/bin/awk                # Set to awk command on system.
  45. PR=/bin/pr                # Set to pr command on system.
  46. FOLDERS=/usr/local/bin/folders        # set to folders command on system.
  47.  
  48. $FOLDERS $@ |
  49.     $AWK '
  50.     /^$/ {                 # Stop at first blank line.
  51.         exit
  52.     };
  53.     NR > 1 {            # Skip first line.
  54.         if ($3 !~ /no/)        # If empty, print 0.
  55.         if (length($9) > 0)    # Is there a current msg in the folder?
  56.             printf "%s:%s>%s\n", $1, $3, substr($9,0,length($9)-1);
  57.         else
  58.             printf "%s:%s>?\n", $1, $3;
  59.         else            # Not empty, print size.
  60.         printf "%s:0\n", $1;
  61.     }
  62.     ' | $PR -4 -w80 -l1            # Format output into 4 columns.
  63.  
  64. #
  65. #------------------------------> End of File <------------------------------
  66. -- 
  67.  
  68. James R. Hamilton                              inet: jrh@jrh.gts.org
  69. telephone: +1 416 493 4162                     uunet: ...!uunet!jrh!jrh
  70. Toronto, Canada                                work: jrh@torolab6.vnet.ibm.com
  71.