Pack Messages into a File
[previous]
[next]
[table of contents] [index]
Normally, MH stores one message per file.
The packf and packmbox commands "pack" messages into a single file.
packf uses MMDF style; packmbox uses UUCP style.
These formats are a good way to package messages for transport to another
computer.
They also take less filesystem space than standard MH folders do:
see the Section
Saving Filesystem Space.
As the Example below shows,
messages packed with packf
are separated by lines of four CTRLA characters.
This is the same way the MMDF transfer agent formats its
system mailboxes.
Example: packf file format
% cat -v packedfile
^A^A^A^A
Header: xxx
Header: xxx
...
Body...
^A^A^A^A
^A^A^A^A
Header: xxx
Header: xxx
...
Body...
^A^A^A^A
Unless you give the -file switch, packf uses a file named
msgbox in the current directory.
If the file exists, the messages are appended.
packf copies all messages in the current folder unless you give a
folder and message numbers.
So, for example, to copy the first ten messages in your current folder
and message 23 from data to the file /tmp/messages:
% packf -file /tmp/messages first:10
% packf -file /tmp/messages 23 +data
For transporting messages between systems or storing them in a file to save
space, packf
is probably the best choice:
it's written in the C language, and it's available on (almost) all MH systems.
The packmbox shell script is useful when you need to pack a folder in
the same format that many non-MH MUAs expect:
the format that UUCP and sendmail use.
packmbox is in the MH library directory from version 6.8 and above.
As the next Example shows,
messages packed with packmbox
are separated by lines starting with From, an address and a date.
packmbox gets the address from the Return-Path: header field,
if there is one; otherwise it creates an address from the From:
field.
If any line in the message starts with the string "From "
("From" and a space), packmbox changes the string to >From .
There's an empty line added after each message.
Example: packmbox file format
% cat packedfile
From ftpmail@online.ora.com Mon Jan 09 10:55:02 1995
Header: xxx
Header: xxx
...
Body...
From ehuser Mon Jan 09 14:17:28 1995
Header: xxx
Header: xxx
...
Body...
packmbox is in your system's
MH library directory,
so you'll probably have to use its absolute pathname.
It writes to the standard output, so you'll want to redirect its output to
a file.
Use the shell's > (right angle bracket) operator to create or
overwrite the packed file; the >> operator will append.
packmbox copies all messages in the current folder unless you give a
folder and message numbers.
So, for example, to copy the first ten messages in your current folder
and message 23 from data to the file /tmp/messages:
% /path/to/library/packmbox first:10 > /tmp/messages
% /path/to/library/packmbox 23 +data >> /tmp/messages
|