35.5 Remove Mail/News Headers with beheadWhen you're saving or re-sending a news article or mail message ( 1.33 ) , you might want to the remove header lines ( Subject: , Received: , and so on). This little script will handle standard input, one or many files. It writes to standard output. Here are a few examples:
Here's the script, adapted a little from the original by Arthur David Olson:
#! /bin/sh case $# in 0) exec sed '1,/^$/d' ;; *) for i do sed '1,/^$/d' "$i" done ;; esac The script relies on the fact that mail messages use a blank line to separate the header from the body of the message. As a result, the script simply deletes the text from the beginning up to the first blank line. - |
|