procmail
[Top] [All Lists]

Spliting mailbox file (no maildir) from script

2005-03-25 05:21:21
Hello *,

I am scripting a tool which let me easier rescan/resort my Mailboxes in
maildirformat like:

  __( '/home/michelle.konzack/src/tdformail-1.3.1/tdformail' )__________
 /
| function err_msg()
| {
|   if [ "$1" == "1" ] ; then 
|     echo "tdformail: error: A 'procmail' occured while filtering the Message 
$NUM."
|     echo "tdformail: aborting."
|     exit 7
|   fi
| }
| 
| if [ -d $BASE ] ; then
|   let NUM=1
|   for MSG in `find $BASE -type f ! -name "maildirfolder"` ; do
|     # Let us see, how many files are filtered and there subject line
|     echo "$NUM : "`grep "^Subject: " $MSG |cut --characters=1-79`
|     # Now we filter.
|     cat $MSG |formail -ds $MDA $RCFILE
|     err_msg $?
|     ################################################################
|     # Remove the originating file
|     if [ "$REMOVE" == "YES" ] || [ "$REMOVE" == "yes" ] ; then
|       rm -f $MSG
|     fi
|     let NUM=$NUM+1
|   done

and it works fine for "MAILDIR" but is the $BASE is a
mailbox file I run into trouble:

| else
|   let NUM=1
|   for MSG in `cat $MSG | formail -ds` ; do
|     # Let us see, how many files are filtered and there subject line
|     echo "$NUM : "`grep "^Subject: " $MSG |cut --characters=1-79`
|     # Now we filter.
|     echo "$MSG" |$MDA $RCFILE
|     err_msg $?
|     let NUM=$NUM+1
|   done
| fi
 \______________________________________________________________________

How can I get on message after one in the "for do done" loop ?
I like to get the whole formailed message in $MSG.

Greetings
Michelle

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/ 
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/3/88452356    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>