Article View: comp.mail.mush
Article #131Re: Saving just mail headers
From: Barton E. Schaefer
Date: Thu, 10 Aug 1989 22:22
Date: Thu, 10 Aug 1989 22:22
84 lines
3830 bytes
3830 bytes
In article <120719@sun.Eng.Sun.COM> argv@sun.UUCP (Dan Heller) writes:
} In article <236@nikhefh.hep.nl> a20@nikhefh.hep.nl (Marten Terpstra) writes:
} > Can anyone tell me if it is possible to just save mail headers without
} > the message body ?
}
} no, but you can save outgoing mail headers only using "set logfile = ..."
"NO?" Not feeling terribly helpful today, Dan? :-) [%]
Of course you can save just the headers, you just can't do it with the
"save" command.
Try
mush> pipe sed -n 1,/\^\$/p >> file
If you want a message list rather than the current message, the list goes
between the "pipe" and the "sed". Note that the Bourne shell, which is
run by the "pipe" command, is performing the >> redirection; mush doesn't
do that itself. [%%]
"pipe" does not write the ignored headers ("ignore" command or "show_hdrs"
variable). If you want to save ALL the headers, you have to do a little
more work:
mush> set print_cmd='sed -n 1,/\^\$/p >> file'
mush> lpr
printing message 11...(219 lines)
1 message printed through "sed -n 1,/\^\$/p >> file".
mush> unset print_cmd
You can of course bundle all this up into a "cmd" alias (the quoting is a
bit nasty, escaped newlines for readability):
cmd sv_hdrs "\
set sv_list ;\
set print_cmd='"'sed -n 1,/\^\$/p >> \!:$'"'"' ;\
lpr $sv_list \!* ;\
unset sv_list print_cmd'
Some non-obvious things going on here. I'll explain the mush ones, sed
is up to you:
set sv_list
This exploits a special feature of the "set" command
to allow you to pipe to sv_hdrs. For example,
pick mush-users | sv_hdrs mu-hdrs
expands to
pick mush-users | set sv_list ; set print_cmd=...
and $sv_list gets set to the messages found by pick.
set print_cmd='sed -n 1,/\^\$/p >> \!:$'
The \!:$ sets the file name to the last argument on the
sv_hdrs command line, for compatibility with "save".
YOU MUST GIVE A FILE NAME! Otherwise you will either
get an error or the message list will be used as a file
name, which probably is not what you want.
lpr $sv_list \!*
The \!:* picks up any message list that was given before
the file name. It also picks up the file name, but the
"lpr" command conveniently ignores that. The $sv_list
spits out whatever messages were piped to sv_hdrs. So
all messages listed and piped get their headers saved.
I think that about covers it. :-) Hope it helps. [+]
____________
% This newsgroup is "comp.mail.mush" not "comp.mush.ask.dan.and.bart".
Anybody else who wants to jump in with a clever suggestion is always
welcome to do so. In fact, I'm going to start waiting a day or two
for other answers to show up, unless somebody jumps in with something
completely wrong.
%% The characters < and > are used in E-mail addresses, so mush avoids
using them as redirection metachars.
+ If you don't want long answers, don't ask leading questions. :-)
____________
--
Bart Schaefer "And if you believe that, you'll believe anything."
-- DangerMouse
CSNET / Internet schaefer@cse.ogc.edu
UUCP ...{sequent,tektronix,verdix}!ogccse!schaefer
Technical Details
Message-ID:
<4177@ogccse.ogc.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!uakari.primate.wisc.edu!indri!ames!think!husc6!ogccse!schaeferReferences:
<236@nikhefh.hep.nl> <120719@sun.Eng.Sun.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!uakari.primate.wisc.edu!indri!ames!think!husc6!ogccse!schaefer From: schaefer@ogccse.ogc.edu (Barton E. Schaefer) Newsgroups: comp.mail.mush Subject: Re: Saving just mail headers Keywords: mail headers Message-ID: <4177@ogccse.ogc.edu> Date: 10 Aug 89 22:22:23 GMT References: <236@nikhefh.hep.nl> <120719@sun.Eng.Sun.COM> Reply-To: schaefer@ogccse.UUCP (Barton E. Schaefer) Organization: Oregon Graduate Center, Beaverton, OR Lines: 84