procmail
[Top] [All Lists]

Re: Help w/splitting

1998-09-13 13:18:33
Dave Wells asked,

| Can anyone tell me what's wrong with this?  I'm trying to split some old
| email archives into individual files while stripping unimportant header
| fields.  From my shell I'm trying:
| 
|   % set FILENO=0000

As Philip said, you need setenv and another space where the equal sign is.
I don't know whether the syntax

VARIABLE=value command

in sh and its compatibles has an analogue for csh and its derivatives.

| followed by the real work:

|   % formail < inputfile -k -X Date: -X From: -X To: -X Subject: -X
|   In-Reply-To: -X X-Mailer: +1 -ds > $FILENO.txt

Aaron Schrab posted a solution that forks sh and cat for every message.  It
can also be done by forking only procmail for every message:

setenv FILENO 0000
formail -kXDate: -XFrom: -XTo: -XSubject: -XIn-Reply-To: -XX-Mailer +1ds \
 procmail -p DEFAULT=`pwd`/'$FILENO.txt' /dev/null < inputfile

or in a shell with sh-style syntax,

FILENO=0000 formail -kXDate: -XFrom: -XSubject: -XIn-Reply-To: -XX-Mailer \
 -XTo: +1ds procmail -p DEFAULT=`pwd`/'$FILENO.txt' /dev/null < inputfile

The keys are to use procmail's -p option, to strong-quote '$FILENO' in the
setting of DEFAULT, and to use /dev/null or a known empty file as the rcfile.

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