Thread View: comp.sys.next.misc
2 messages
2 total messages
Started by Grant J. Munsey
Thu, 30 Jul 1992 21:45
Stripping mail headers
Author: Grant J. Munsey
Date: Thu, 30 Jul 1992 21:45
Date: Thu, 30 Jul 1992 21:45
8 lines
788 bytes
788 bytes
I sometimes get several mail messages that are parts of a uuencoded file. I want to strip off the mail headers so I can combine the mail message bodies and uudecode the result. Can you do this some way from NeXT Mail. If not is there some program that takes a sequence of concatinated mail messages and stripps the header lines? Thanks, ---- Grant Munsey, Mainticore, Inc. (408)252-1135 grant@Manticore.COM, uunet!ub-gate!gouche!grant NeXTMail ok.
Re: Stripping mail headers
Author: Alex D. Nghiem
Date: Mon, 03 Aug 1992 22:57
Date: Mon, 03 Aug 1992 22:57
90 lines
3390 bytes
3390 bytes
Grant:
I wrote the following shell script to cut out the mail headers and the "cut
here" that is inserted by the mail server at nova.cc.purdue.edu. Maybe you can
modify it to do what you need. To use this shell script:
1. create a temporary mailbox -- call it temp
2. transfer the files you want to the mailbox: it's important that you transfer
them in order, since this basically writes the text to a file, and you need the
text to be in order (otherwise, uudecode will fail). Additionally, you need to
compact the mailbox to make sure there's no extraneous data
3. cd ~/Mailboxes/temp.mbox and copy the mbox file to /tmp
4. run this shell script and redirect the output to a file, which removes all
the mail headers and "cut here" from the file
5. uudecode the resulting file and you're set!
=====================================================
#!/bin/sh
# shell script to cut and reconstruct files downloaded from
# a mail server
INPUT_FILE=$1
TEMP_FILE=/tmp/line_numbers
SED_FILE=/tmp/cut.sed
# find out how many "cut here" there are in the files
# and at what lines they occur at: use awk to strip
# out the rest of the line and only obtain the line numbers
grep -n "cut here" $INPUT_FILE | awk ' BEGIN { FS=":" } { print $1 } ' >
$TEMP_FILE
# create sed script to delete all the mail headers,
# blank lines and lines with "cut here"
awk '
# read entire file into an array
{
line[NR] = $0
}
END {
print "1," line[1] "d"
i=2
while (i < NR)
{
print line[i] "," line[i+1] "d"
i++
i++
}
print line[NR] "d"
} ' $TEMP_FILE > $SED_FILE
# run sed with the sed script just created to delete
# all mail headers and blank lines
sed -f $SED_FILE $INPUT_FILE
rm -f $TEMP_FILE
=====================================================
Hope this helps...
If I can be of any further help, please feel free to contact me.
Best regards,
Alex Duong Nghiem Phone: (512) 343-1111
Pencom Software Fax: (512) 343-9650
9050 Capital of TX Hwy N. Mail: alex@pencom.com
Suite 300 Mail: co-Xist_support@pencom.com
Austin, TX 78759 Mail: co-Xist_info@pencom.com
USA
****************************
* NeXTMail gladly accepted *
****************************
In article <337@gouche.UUCP> grant@Manticore.COM (Grant J. Munsey) writes:
> I sometimes get several mail messages that are parts of a uuencoded
> file. I want to strip off the mail headers so I can combine the mail
> message bodies and uudecode the result. Can you do this some way from
> NeXT Mail. If not is there some program that takes a sequence of concatinated
> mail messages and stripps the header lines? Thanks,
> ----
> Grant Munsey, Mainticore, Inc. (408)252-1135
> grant@Manticore.COM, uunet!ub-gate!gouche!grant NeXTMail ok.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads