🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.mail
Article #37

Re: [rmail] File Conversion: RMAIL -> mbox

#37
From: KANNO Hideo
Date: Wed, 12 Aug 1992 01:59
241 lines
9108 bytes
$B?@Ln!wEl5~Bg3X$G$9!#(J
$B;d$N(Jrmail$B$N!"(JRMAIL->mbox $B$NJQ49J}K!$N<ALd$K$D$$$F!"(J
$BB??t$N%U%)%m!<!"%a!<%k$rD:$-$^$7$?!#(J

$B$I$&$b!"$"$j$,$H$&$4$6$$$^$7$?!#(J

$B$^$H$a$5$;$FD:$-$?$$$H;W$$$^$9!#(J

fj.editors.emacs$B$K$b%/%m%9%]%9%H$7$^$9!#(J

:::::::::
$B<ALd5-;v(J
:::::::::

  From: hideo@tansei.cc.u-tokyo.ac.jp (KANNO Hideo)
  Subject: [rmail] File Conversion: RMAIL -> mbox
  Message-ID: <2788@tansei1.tansei.cc.u-tokyo.ac.jp>

$BF|:"!"IaDL$N(Jmail$B%3%^%s%I$r;H$C$F$$$^$9$,!"(J
mbox $B$r(Jrename$B$;$:$K!"(Jnemacs$B$+$i(Jrmail$B$rN)$A$"$2$F!"(J
$B8m$C$F!"(Jmbox$B$r(JRMAIL$B$K=q$-49$($i$l$F$7$^$$$^$7$?!#(J

RMAIL$B%U%!%$%k$rB?>/JQ$($F$_$?$j$b$7$^$7$?$,!"(Jmbox$B$H$7$FG'<1$5$l$^$;$s!#(J
RMAIL$B$r(Jmbox$B$K=q$-49$($k5!G=$O!"%5%]!<%H$5$l$F$$$^$9$G$7$g$&$+!)(J
$B$"$k$$$O!"$I$3$r$I$&=q$-49$($l$P$$$$$N$G$7$g$&$+!)(J

$B$h$m$7$/$*4j$$$7$^$9!#(J


::::::
$BL\<!(J
::::::

$B0pB<!w(JICOT$B$5$s(J      rmail$B$O%5%]!<%H$7$F$$$J$$!#(Jgnu.emacs.help FAQ LIST $B$+$i!#(J
$BBg0f!w(JASTEM$B$5$s(J     $BB?$/$J$1$l$P!"(J^o$B$G=q$-=P$9!#(J
$B:j;3!wEl5~Bg3X$5$s(J  $B%-!<%\!<%I%^%/%m$K$7$F7+$jJV$7<B9T$5$;$k!#(J
$B<c5\!wIY;NDL8&$5$s(J  r2m
$B:{It!wEl5~Bg3X$5$s(J  rmail-to-mbox

$B0pB<$5$s!":{It$5$s$+$i$O%a!<%k$GD:$-$^$7$?!#>5Bz$rF@$FE>:\$7$^$9!#(J


:::::::::::::::
$B7k6I;H$C$?$b$N(J
:::::::::::::::

$B$$$A$P$s:G=i$K<u$1<h$C$?(J($B$J$s$H?t==J,8e(J)$B4X78$G!"(J
$B:{It$5$s$,$b$C$F$i$C$7$c$C$?!"%7%'%k%9%/%j%W%H(Jrmail-to-mbox$B$r;H$$$^$7$?!#(J
bin/sh$B$G!"(J
$B!!!!(Jrmail-to-mbox RMAIL 
$B$H$9$k$H!"$+$J$jCY$$$G$9$,!"(J
$B!!!!(JRMAIL.mail  
$B$H$$$&(J mbox format $B$N%U%!%$%k$r:n$C$F$/$l$^$9!#(J

$B7gE@$O!"(JFrom$B9T$NF|IU$,!"$9$Y$FJQ49$7$?F|$K$J$C$F$7$^$&$N$H!"(J
Received $B$J$I%X%C%@!<$N$[$H$s$I$,:o$i$l$F$7$^$&$3$H$G$9!#(J


:::::::::::
$BD:$$$?5-;v(J
:::::::::::

   To: hideo@tansei.cc.u-tokyo.ac.jp (KANNO Hideo)
   From: INAMURA =JANE= You <inamura@icot.or.jp>

$B$O$8$a$^$7$F!##I#C#O#T$N0pB<$H?=$7$^$9!#B?$/$N2sEz$,=8$^$j$=(J
$B$&$G$9$N$G(J mail $B$K$FEz$($5$;$FD:$-$^$9!#(J
$B$J$*!"I,MW$,$"$j$^$7$?$i$3$N(J mail $B$O<+M3$K(J news $B$K0zMQ!?E>:\(J
$B$7$F2<$5$C$F7k9=$G$9$N$G!#(J

gnu.emacs.help $B$KN.$l$k(J FAQ $B$+$iE>:\$7$^$9$H!"(J

>>In article <GNU-Emacs-FAQ-5.1992.06.28.234430@bigbird.bu.edu>,
>>      jbw@bigbird.bu.edu (Joe Wells) writes:
JW>  RMAIL
JW>  provides no obvious way to reverse this transformation.  To convert a mail
JW>  file back to standard Unix format, there are several methods:

JW>  * Use the rmail-output ("C-o") command within RMAIL on each message in the
JW>    file.  First use M-x rmail or M-x rmail-input to visit the RMAIL file in
JW>    Rmail mode.  Type "1 j" to go to the first message.  Use the C-o command
JW>    to output the message to a Unix format file.  Type "n" to go to the next
JW>     message.  Repeat.

JW>  * If the file contains hundreds of messages, you may not want to repeat
JW>    this for all of them.  Instead of the above, after getting to the first
JW>    message type this (where "mbox" is the file you want to put the messages
JW>    in):

JW>       C-x ( C-o mbox RET M-s ^From: RET M-0 C-x )

JW>    (The rmail-search command ("M-s") is used instead of just "n" because it
JW>    is the only command which will cause an error when it reaches the last
JW>    message in the file, which is necessary to terminate the keyboard macro.
JW>    This will fail if there are messages in the file that don't have a
JW>    `From:' header.  This assumes rmail-delete-after-output is nil.)

JW>    It is wise to save a copy of the RMAIL file first, in case you make a
JW>    mistake.

JW>  * There are software packages available for converting files or even
JW>    entire directories of BABYL files to standard Unix format.  These are
JW>    helpful in this situation, but are intended mainly for people who have
JW>    used RMAIL for a long time and are converting to some other mail reader.
JW>    Lookup `rmail', `vm', and `babyl' in the Emacs Lisp Archive (see
JW>    question 91).

$B$H$$$&$3$H$G$9!#(JRMAIL $B$OJQ49$9$k5!G=$r%5%]!<%H$7$F$$$J$$$+$i!"(J

  *$B#1%a%C%;!<%8Kh$K(J ^o $B$G=PNO$9$k$+(J
  *$B%a%C%;!<%8$N?t$,B?$/$FBgJQ$J$i(J keyboard macro $B$GBP=h$9$k$+(J
  *$B$=$l$bBgJQ$J$iJQ49MQ$N%Q%C%1!<%8$r<j$KF~$l$k$+(J

$B$7$F$M!"$H$$$&$3$H$_$?$$$G$9$M!#(J

$B$A$J$_$K!"(Jarchie $B$G(J `babyl' $B$b$7$/$O(J `rmail' $B$GC5$7$F$_$?$H(J
$B$3$m!"$=$l$i$7$$%Q%C%1!<%8$,4v$D$+$"$k$i$7$$$3$H$@$1$O3NG'$G(J
$B$-$^$7$?!#(J


$B0J>e!"$*Lr$KN)$F$^$7$?$i9,$$$G$9!#(J


$B"t<XB-!'$3$NJU$j$NOCBj$O(J fj.editor.emacs $B$X$b(J cross post $B$7(J
$B"t(J      $B$F$*$/$H!"$h$jNI$$Ez$,F@$i$l$k2DG=@-$,9b$$$H;W$o$l$^(J
$B"t(J      $B$9!"$?$V$s!#(J


$B0pB<!w#I#C#O#T(J

--------

  From: oi@kocb.astem.or.jp (Hitoshi Oi)
  Message-ID: <OI.92Aug11164631@tlh.kocb.astem.or.jp>

	$B%a%$%k$N?t$,$=$s$J$K$J$1$l$P(J ^o $B$G0l$D$:$D(J mbox $B$K=q$-=P$7$F(J
	$B$$$/$C$FJ}K!$,$"$j$^$9$h$M(J

--------

  From: nobuo@is.s.u-tokyo.ac.jp (SAKIYAMA Nobuo)
  Message-ID: <1992Aug10.101054.26489@kei.is.s.u-tokyo.ac.jp>

$BBg0f$5$s(J> $B%a%$%k$N?t$,$=$s$J$K$J$1$l$P(J ^o $B$G0l$D$:$D(J mbox $B$K=q$-=P$7$F(J
>	  $B$$$/$C$FJ}K!$,$"$j$^$9$h$M(J
$B$5$i$K!"%-!<%\!<%I%^%/%m$K$7$?$&$($G%(%i!<$G;_$^$k$^$G7+$jJV$7<B9T$5$;(J
$B$k$H$$$&<j$r!"(Jrmail$B$+$i(Jvm$B$K0\9T$7$?$H$-$K;H$C$?5-21$,$"$j$^$9!#(J
C-o$B$@$1$G$O?t0z?t$r$D$1$i$l$J$+$C$?$N$G!"%^%/%m$K$7$?$H5-21$7$F$$$^$9!#(J

$B!t$R$s$Q$s$K$=$s$J$3$H$r$9$k$J$i!"$^$8$a$K(Jelisp$B$G=q$/$1$I!"(J1$BEY$7$+I,MW(J
$B!t$J$+$C$?$N$G!"$3$s$J$b$s$G$9!#(J

--------

  From: wkenji@flab.Fujitsu.Co.JP (Kenji WAKAMIYA)
  Message-ID: <WKENJI.92Aug10220041@einstein.center.flab.Fujitsu.Co.JP>

  $BBg@N$K:n$C$?$3$H$,$"$k$N$r;W$$=P$7$^$7$?!$0J2<$N4X?t$G$9!%(JRMAIL $B%U%!(J
  $B%$%k$r%P%C%U%!$K<h$j9~$s$G!$(JM-x r2m $B$H$d$C$F$_$F2<$5$$!%%P%C%U%!$NCf(J
  $B?H$,(J mbox $B7A<0$KJQ$o$j$^$9!%(J

$B!t$7$+$7$h$/<h$C$F$"$C$?$J$!!%(J
---------->8---------->8---------->8---------->8---------->8----------
;;; A function for file conversion RMAIL to mbox

(provide 'r2m)
(require 'mail-utils)

(defun r2m ()
  "Convert RMAIL file in current buffer to mbox format."
  (interactive)
  (goto-char (point-min))
  (re-search-forward "^\^_" nil t)
  (delete-region (point-min) (point))
  (while (= (following-char) ?\^L)
    (set-mark (1- (point)))
    (re-search-forward "^\\*\\*\\* EOOH \\*\\*\\*\n" nil t)
    (delete-region (mark) (point))
    (narrow-to-region (point) (point-max))
    (insert "From "
	    (or (mail-strip-quoted-names (mail-fetch-field "from"))
		"unknown")
	    " "
	    (current-time-string)
	    "\n")
    (re-search-forward "^\^_" nil t)
    (save-excursion (beginning-of-line) (insert "\n")))
  (delete-char -1)
  (widen))

-------------

  From: SASABE Tetsuro <tss@a.u-tokyo.ac.jp>
  To: hideo@tansei.cc.u-tokyo.ac.jp (KANNO Hideo)

  $B$=$&$$$&%7%'%k%9%/%j%W%H!J<BBN$O(J elisp $B$G$9$,!K$,$"$j$^$9!#C;$$$N$G(J
$B$3$N8e$m$KIU$1$F$*$-$^$9!#=P=j$O(J usenet $B$N$I$3$+$N$h$&$G$9$,!"K:$l$F$7(J
$B$^$$$^$7$?(J :-)$B!#(J


----------------------------------------------------------------------
#!/bin/sh
#
# usage:	rmail-to-mail file1 file2 ...
#
# result:	file1~     is the original Babyl file
#		file1      is an empty Babyl file
#		file1.mail is a UNIX mail file with the messages from file1

cat > /tmp/$$.el << EOF
;;;
;;; Author:  Nathan Hess  (woodstock@hobbes.intel.com)
;;;
;;

(let ((file-to-be-converted (buffer-file-name))
      (message-count 0)
      (rmail-delete-after-output t)
      (unix-style-file-name (concat (buffer-file-name) ".mail")))
  (kill-buffer (current-buffer))
  (rmail file-to-be-converted)
  (rmail-show-message 1)
  (while (not (rmail-output unix-style-file-name))
    (setq message-count (1+ message-count)))
  (rmail-quit))
EOF

for f in "$@" ; do
    echo ">>> Doing $f"
    emacs -batch $f -l /tmp/$$.el -kill
    echo ">>> Done"
done

rm -f /tmp/$$.el

----------------------------------------------------------------------
--
            _      .---    KANNO HIDEO     kanno@tansei.cc.u-tokyo.ac.jp 
  _________/ |__--'@/      Dept. of Biophysics & Biochemistry, Univ. of Tokyo
 (__PAN AM/__|__===-~      3-1, Hongo 7-chome, Bunkyo-ku, Tokyo 113, JAPAN 
                           (JALNET: JAL13073, NIFTY-Serve: GFC00670)
Technical Details
Message-ID: <2798@tansei1.tansei.cc.u-tokyo.ac.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!yayoi!tansei1!hideo
References: <2788@tansei1.tansei.cc.u-tokyo.ac.jp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ccut!news.u-tokyo.ac.jp!yayoi!tansei1!hideo
From: hideo@tansei.cc.u-tokyo.ac.jp (KANNO Hideo)
Newsgroups: fj.mail,fj.editor.emacs
Subject: Re: [rmail] File Conversion: RMAIL -> mbox
Message-ID: <2798@tansei1.tansei.cc.u-tokyo.ac.jp>
Date: 12 Aug 92 01:59:32 GMT
References: <2788@tansei1.tansei.cc.u-tokyo.ac.jp>
Sender: news@tansei.cc.u-tokyo.ac.jp
Followup-To: fj.mail
Distribution: fj
Organization: Computer Centre, University of Tokyo
Lines: 241