Subject: egrep body but filter head

From: [email-masked] (David W. Tamkin)
Date: Thu, 2 Feb 1995 15:56:52 -0600 (CST)

Richard Coleman wrote on the SmartList list,
| 
[I had written:]

| > Now here's my question for Stephen: wouldn't this work?
| > 
| >  :0Bhfw
| >  * $ ^^$X_COMMAND:
| >  | sed /./!d
| >  # or sed -n /./p, or sed '/^$/d'

| I like that one.  Just egrep through the body to match the condition,
| but only filter the header.  Pretty cool.  I've always wondered which
| part of the message the blank line separating the header and body
| was considered when using B,H,h,b.  I guess from this recipe, it
| is always considered part of the header. Correct?

Yes, though if there are two or more blank lines, only the first is treated
as the end of the head; the rest are part of the body.

For example, this will have the same effect:

 :0Bwhf and maybe other flags
 * $ ^^$X_COMMAND:
 | formail -X ""

Note that with the -k option as well as -X, formail will preserve the blank
line.  The following recipe would make no changes at all (assuming that the
message is already in proper mailbox format):

 :0f
 | formail -bkX ""