Re: automatic limiting (by date)

2000-05-31 Thread David T-G

Hi again!

I suppose I should answer my own question now that I've figured it out;
this works pretty well and I'm even looking at letting my script clear my
procmail log for me.

...and then David @ BigFoot said...
% Hi, folks --
% 
% I dump my incoming mail into =F.* with procmail, and I have a little
% alias that keeps track of the log and gives me stats like 
% 
%   -rw-r--r--   1 davidtg 0 Mar  1 15:24 .mail.log.date
%   The current date is: Mar  2 08:37
% 
%   50
%   Folder: /usr/bin/formail
%   Folder: /var/spool/mail/davidtg
%   Folder: F.funnies
%   Folder: F.lists
%   Folder: F.mutt
%   Folder: F.news
%   Folder: F.root
% 
% I can thus see how many new messages (50) have come in since I last
% cleared the log, and where they landed (a few just went through formail,
% some hit $MAIL, and the rest landed in =F.*).  If I stay on top of things,
...
% I'd like to whip up a little muttrc which says
% 
%   source $HOME/mutt/.muttrc
%   push 'l ~r 01/03/2000-'
% 
% and then fire up mutt on the F.* folder using -F to source *this* muttrc
% file, but I can't get the push grammar right.  Maybe push isn't what I
% need to just limit the display, perhaps.  Help!

The little script that checks the date of last clearing and then
generates the date-limited muttrc (as well as generating the folder list)
is attached.  As expected, it was simply a matter of quoting properly :-)


:-D
-- 
David T-G   * It's easier to fight for one's principles
(play) [EMAIL PROTECTED]  * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.bigfoot.com/~davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001.  There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*



#!/bin/sh

# quick hack to show all mail since last procmail clear in all folders

# get folder list from procmail log; get date from timestamp ; build muttrc

# get folder list from procmail log
list=`egrep '^  Folder: F' $HOME/.procmail/.mail.log | awk '{print $2}' | sort -u`

# get last-cleared date from timestamp file
eval `/bin/ls -lFo $HOME/.procmail/.mail.log.date | awk '{print "month=" $5 "; day=" 
$6 "; time=" $7}'`

# parse some fields
case $month in  # convert to numeric
  Jan ) mon=01 ;; Feb ) mon=02 ;; Mar ) mon=03 ;; Apr ) mon=04 ;;
  May ) mon=05 ;; Jun ) mon=06 ;; Jul ) mon=07 ;; Aug ) mon=08 ;;
  Sep ) mon=09 ;; Oct ) mon=10 ;; Nov ) mon=11 ;; Dec ) mon=12 ;;
esac
[ $day -lt 10 ]  day=0$day# force two-digit
case $time in
  [0-9][0-9][0-9][0-9] ) year=$time ;;  # strange but true
  [0-9][0-9]:[0-9][0-9] ) year=`date +%Y`   # get the year
esac

# create special muttrc for since-this-date
cat  $HOME/.mutt/muttrc.date  END_OF_MUTT
source $HOME/.mutt/muttrc
push "l ~N ~r $day/$mon/$year-\n"
END_OF_MUTT

# read the list of mailboxes

for box in $list
do
  mutt -F $HOME/.mutt/muttrc.date -f =$box
done


## .../.procmail/.mail.log.date.last
## .../.procmail/.mail.log.`cat ...date.last`


 PGP signature


automatic limiting (by date)

2000-03-02 Thread David T-G

Hi, folks --

I dump my incoming mail into =F.* with procmail, and I have a little
alias that keeps track of the log and gives me stats like 

  -rw-r--r--   1 davidtg 0 Mar  1 15:24 .mail.log.date
  The current date is: Mar  2 08:37

  50
  Folder: /usr/bin/formail
  Folder: /var/spool/mail/davidtg
  Folder: F.funnies
  Folder: F.lists
  Folder: F.mutt
  Folder: F.news
  Folder: F.root

I can thus see how many new messages (50) have come in since I last
cleared the log, and where they landed (a few just went through formail,
some hit $MAIL, and the rest landed in =F.*).  If I stay on top of things,
I can run through each of the F.* folders, set the sort to unsorted
(hmmm...  is there a reverse-unsorted, funny though that sounds, so that
I could just go to message 1 every time?), and check the bottom couple
of messages to make sure that nothing was misfiled, even if I don't want
to read things right now.

It gets a little hairier if I go on vacation for a week :-)  Unsorted
mode still helps, but I am now sufficiently advanced to use 'limit' to
show me only messages since a certain date -- like "l ~r 01/03/2000-"
for this example (though I also wish there were a $date_format setting
so that I could use /MM/DD instead :-)

I'd like to whip up a little muttrc which says

  source $HOME/mutt/.muttrc
  push 'l ~r 01/03/2000-'

and then fire up mutt on the F.* folder using -F to source *this* muttrc
file, but I can't get the push grammar right.  Maybe push isn't what I
need to just limit the display, perhaps.  Help!

Eventually, all of this will be dynamically generated by a little script
which parses the procmail log in much the same way as the alias, but
grabs only the =F.* folders, and then creates the limit command based
on the .mail.log.date timestamp...  Maybe I should just a -e command when
calling mutt from the script instead of a .muttrc file, too...


TIA

:-D
-- 
David T-G   * It's easier to fight for one's principles
(play) [EMAIL PROTECTED]  * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.bigfoot.com/~davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001.  There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


 PGP signature