[comp.mail.misc] sed script to summarize mailbox

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

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}