procmail
[Top] [All Lists]

Re: Is there any way to detect NULLs in email messages?

1998-05-07 15:53:36
Timothy Luoma asked,

| Is there any way to detect NULLs using procmail, and possibly convert them
| to something else or simply delete them?

Procmail can handle nulls; the problem is that your editor may be unable to
insert a null into your .procmailrc.

A condition to detect the presence of a null, if you can edit a null into
your .procmailrc, is easy enough to write:

 * HB ?? ^@

[where ^@ is an actual null, not caret-at].  If your editor allows you to
enter a character #255 but not a null, you can do this:

 * HB ?? [^A-\255]

where ^A is a ctrl-A [not caret-A] and \255 is an actual character #255 (not
backslash-2-5-5).

Finally, if your editor won't let you enter a character #255 either, but it
allows you to filter a single line, you might be able to enter some tempo-
rary character for the character #255 and then run that line through tr
to change it to a #255.

All told, you might want to make the recipe unconditional, since it won't
hurt a message that contains no nulls.

The action line to get rid of nulls is another question.  If your local
version of tr hates nulls, then it drops them automatically:

  :0fw
  | tr

if it respects nulls, you'll need to tell it the options to remove them:

 :0fw
 | tr -d \\0