[alt.sources] sed script to summarize mailbox

john@trigraph.uucp (John Chew) (12/09/89)

Original-posting-by: john@trigraph.uucp (John Chew)
Reposted-by: emv@math.lsa.umich.edu (Edward Vielmetti)
Posting-id: 891208.1928
Posting-number: Volume TEST, Number TEST
Archive-name: from.sed - summarize messages in a mailbox (replacement for BSD from(1))

[This is an experimental alt.sources re-posting from the
newsgroup(s) comp.mail.misc.
No attempt has been made to edit, clean, modify, or otherwise
change the contents of the original posting, or to contact the
author.  Please consider cross-posting all sources postings to
alt.sources as a matter of course.]

[Comments on this service to emv@math.lsa.umich.edu (Edward Vielmetti)]

A few days ago I got tired of waiting for /usr/ucb/from to waddle
its way through my mailbox every time I logged on, browsed through
the source, and when the nausea subsided, wrote the following sed
script.  Cut it, save it as from.sed, and invoke it (most likely
through a shell alias) with 'sed -n -f from.sed YOUR-MAILBOX-NAME'.
The script searches for lines beginning "From ", swaps date and
sender, truncates or pads sender to ten characters, searches for
and appends the subject and prints all three on a line.

Yeah, it's obvious, but it took me a few years to think of
doing it, so it might save a few netperson-years out there.

Comments, criticisms, suggestions, etc. welcome.

John
----- BEGIN from.sed
# from.sed - summarize messages in a mailbox
# $Header: from.sed,v 1.1 89/12/07 16:49:52 john Rel $
# Copyright (C) 1989 John J. Chew, III <poslfit@gpu.UTCS.UToronto.CA>
# you may distribute this file freely as long as you do not change it
/^From /!d
s///
s/^[^ ]*!\([^ !]*\) /\1 /
s/^\([^ @]*\)@[^ ]* /\1 /
s/ /           /
s/^\(..........\)[^ ]* *\(.*\)/\2 \1/
h
: loop
n
/^$/b
/^Subject:/!b loop
H
g
s/\nSubject: */ /p
----- END from.sed -----
-- 
john j. chew, iii   		  phone: +1 416 425 3818     AppleLink: CDA0329
trigraph, inc., toronto, canada   {uunet!utai!utcsri,utgpu,utzoo}!trigraph!john
dept. of math., u. of toronto     poslfit@{utorgpu.bitnet,gpu.utcs.utoronto.ca}