When T. C. Thomas asked,
| > | Can you tell me how to do this (chop signature with sed)?
I suggested,
| > :0Bfw
| > * ^-- *$
| > | sed '/^-- *$/,$ d'
| >
| > provided, of course, that the start of the signature is marked with the
| > traditional separator.
to which Bob Weissman responded,
| The traditional separator would dictate using
|
| :0Bfw
| * ^-- $
| | sed '/^-- $/,$ d'
|
| In other words, the separator ought to be hyphen, hyphen, space on a
| line by itself.
Yes, it *ought*.
| This is not to say that everyone uses correct separators.
Exactly: there was a reason I used the phrase "the traditional separator"
rather than, say, "the received separator according to gospel" or "the ideal
separator" or "the technically correct separator." Many people had software
that didn't add it, so they'd type it in themselves, and not knowing about
the trailing space they'd leave it out, or some transports would strip trail-
ing spaces to reduce bulk (a wrong move, but it happened). Occasionally
there would be more than one trailing space.
Whichever way you look at it, the recipe is less than ideal: it should have
the `b' flag (as well as `B') to filter only the body; there's no point in
sedding the head.
So,
:0Bfbw
* ^\/-- *$
| sed "/^${MATCH}$/,$ d"
Remove the asterisk from the second line if you wish to remove only properly
separated signatures.