procmail
[Top] [All Lists]

Re: Efficiency and logging multiple lines

2002-07-22 06:44:56
On 22 Jul, Mark Bynum wrote:
| [...]
| 
| Storing that for each message, and then logging by:
| 
| :0 c:maillog.lock
|| echo $FROM "^M" $SUBJECT "^M" $SPAM "^M" "------" \
|         >> $HOME/.procmail/maillog
| 
| But I can't seem to get the linefeeds or carriage returns to work right.
| I believe my echo (FreeBSD) doesn't like the ^M (that's an embedded
| carriage return) or even /n that some
| shells do (I set SHELL=/bin/sh). Here is what I get in my maillog:
| 
| From: Mark Bynum <mark(_at_)mjbynum(_dot_)org>^MSubject: 
Testing^MX-Spam-Status: No, hits=-
| 99.1 required=5.0 tests=FROM_AND_TO_SAME,USER_IN_WHITELIST 
version=2.20^M------
| 
| Is there an easier, more efficient way to do this?

1). That would be "\n", not "/n".
2). This will be version dependent, but try "echo -e".
3). "\n" (\012) and ^M (\r or \015) are not the same thing.
    You probably don't want ^M, but you might know better.
4). All of this is unnecessary. Use LOGFILE and LOG

LOCKFILE = $HOME/.procmail/maillog.lock
OLDLOG = $LOGFILE
LOGFILE = $HOME/.procmail/maillog
LOG = "$FROM
 $SUBJECT
 $SPAM
 ------
"
LOGFILE = $OLDLOG
LOCKFILE

Alternatively, some people define a variable such as:

NL="
"
LOG = "$FROM $NL $SUBJECT $NL $SPAM $NL ------$NL"

Of course, if you really do need an embedded carraige return and not
just a newline, you'll have to put that in the variable too (almost
certainly in addition to, and not in place of, the newline).

-- 
Reply to list please, or append "8" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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