mark david mcCreary <mdm(_at_)internet-tools(_dot_)com> writes:
I want to remove all X headers from the email.
The obvious solution, using formail, does not work
:0 fhw
| formail -I X-*:
Close, but not quite:
:0 fhw
| formail -I X-
When matching headers, formail just looks for those headers with start
with whatever you gave to formail. Normally, one includes a colon (or
space, in the case of the pseudo-header "From ") to restrict this to
only one name. However, if you don't do that it will act as a
wildcard.
Note that this doesn't make sense with the -a or -A arguments, as they
require a value, not just a name. However, all the other header
arguments will accept wildcards and do the reasonable thing with them:
formail -i X- # stick a "Old-" in front of all "X-" headers
formail -I X- # remove all "X-" headers
formail -R X- Y- # Change the "X-" headers to "Y-" headers
formail -R X- Foo: # Change all "X-" headers to "Foo:" headers
# losing whatever was after the "X-".
formail -u X- # Make "X-" headers unique, taking the first
# occurence of each different header name.
formail -x X- # Extract the values from all "X-" headers.
formail -X X- # Extract all the "X-" headers.
Cool, eh?
Philip Guenther
PS. The last character given in the header name doesn't need to be a
'-'. All the above examples would work just as well with "Bar" instead
of "X-".