Path: utzoo!attcan!uunet!abcfd20.larc.nasa.gov!tab00.larc.nasa.gov!scott From: scott@tab00.larc.nasa.gov (Scott Yelich) Newsgroups: comp.unix.questions Subject: Re: Stripping a mail header Message-ID: Date: 27 Sep 90 20:39:01 GMT References: <4011@umbc3.UMBC.EDU> Sender: news@abcfd20.larc.nasa.gov (USENET File Owner) Organization: NASA Langley Research Center, Hampton, Va. 23665 Lines: 32 In-Reply-To: cs201402@umbc5.umbc.edu's message of 24 Sep 90 22:46:33 GMT Heh, I wrote one of these for our systems graders my first year here! The problem is that I wrote it in csh (my login shell) before I learned that csh was BAD to program in. Anyway, I will tell you what I used, but I will not give you my code (it's REALLY awful, and 3 years old!) 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! The above example works on an entire mail spool file. If you are only going to do a single mail, try this: awk 'NF == 0 {BODY = 1} BODY == 1 {print $0}' <$LETTER >$BODY Good luck! Scott -- Signature follows. [Skip now] ----------------------------------------------------------------------------- Scott D. Yelich scott@[xanth.]cs.odu.edu [128.82.8.1] After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?'' Administrator of: Game-Design requests to ODU/UNIX/BSD/X/C/ROOT/XANTH/CS/VSVN/ -----------------------------------------------------------------------------