Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!genrad!decvax!harpo!seismo!hao!hplabs!sri-unix!coleman@nrl-aic From: coleman%nrl-aic@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: removing header lines Message-ID: <2266@sri-arpa.UUCP> Date: Fri, 17-Jun-83 11:06:00 EDT Article-I.D.: sri-arpa.2266 Posted: Fri Jun 17 11:06:00 1983 Date-Received: Sun, 19-Jun-83 15:22:33 EDT Lines: 70 From: Jeff ColemanBelow is a header-line filter that only deletes lines in the header, i.e., lines between the beginning of the message and the first blank line. Works on a single message or file of messages preceded by a line containing only SEPARATOR (edit to reflect your preference--I use control-C). It is faster than a less-powerful awk version I used for a while. Tested on a 4.1bsd system. The separator is treated as a not-to-be-deleted header line. Consequently, a separator preceding the first message is left intact while a separator following the last message looks like an incomplete one-line message and is deleted. A blank line after the trailing separator makes it a complete "header" and will cause the separator to be undisturbed. -------------------------------------------------- #! /bin/sh # Filter to remove undesired header lines from a message or a file of # SEPARATOR-preceded messages. As a side effect, it compresses # multiple-line header fields into a single line. # Jeff Coleman 6/17/83 # coleman@nrl-aic # At the top of ":Loop" the previous input line, no part of which has been # printed, is in the hold space. It may be a compounded line. At ":Break" # the hold space holds a copy of the current input line and the pattern # space contains the current input line catnenated with the previous # (possibly compound) input line. The previous part is printed if # appropriate. sed \ '1,/^$/bHead /^SEPARATOR$/,/^$/{ :Head 1bLine1 /^SEPARATOR$/{ :Line1 h d } :Loop H x s/[ ]*\n[ ][ ]*/ / tMore bBreak :More h d bLoop :Break /^From / bFinish /^Message-I[Dd]: / bFinish /^In-[Rr]eply-[Tt]o: / bFinish /^Origin: / bFinish /^Remailed-[Ff]rom: / bFinish /^Remailed-[Dd]ate: / bFinish /^Remailed-[Tt]o: / bFinish /^Mail-[Ff]rom: / bFinish /^Via: / bFinish /^Return-[Pp]ath: / bFinish /^Received: / bFinish /^Article-I.D.: / bFinish /^Sender: / bFinish ***Error on net connection*** === brl netread error from NRL-AIC at Fri Jun 17 11:25:46 ===