Stripping a mail header

Paul John Falstad pfalstad at phoenix.Princeton.EDU
Fri Sep 28 07:16:27 AEST 1990


In article <SCOTT.90Sep27163901 at tab00.larc.nasa.gov> scott at tab00.larc.nasa.gov (Scott Yelich) writes:
>awk '$1     == "From" && NF == 7 && HEADER == 0 {HEADER=1;}\
>     HEADER == 0                                {print $0 }\
>     NF     == 0                                {HEADER=0;}'
>You can put that in a pipe and what comes out the other side will be
>the body of the message.  Switch ``HEADER == 0'' to ``HEADER == 1''
>and you will only get the headers!

Or, try this:

sed '/^From/,/^$/d' mailfiles ...

To get the headers:

sed -n '/^From/,/^$/p' mailfiles ...

Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
I'd like to answer this question, if I may, in two ways.  Firstly in
my normal voice, and then in a kind of silly high-pitched whine.



More information about the Comp.unix.questions mailing list