Search this site


Metadata

Articles

Projects

Presentations

converting mbox to mh

I had a bit of mail in my old mbox files that I wanted to refile to mh, so here's the oneliner that does it.
cat main | \
perl -e '\
$x = 0; \
while (<>) { \
   if (m/^From /) { \
      $x++; \
      open(MAIL, "> $x"); \
   }; \
   print MAIL $_; \
}'
main is the name of the mbox. After doing this, I simply used the refile(1) command to drop them in my main mh folder. <3 perl.

0 responses to 'converting mbox to mh'

Showing last 0 comments... (Click here to view all comments)


Leave a reply

You need javascript enabled to use this form. Anti-spam efforts ongoing. Also, if the comment doesn't show up, it's because the form expired. Go back and copy your comment, reload the form, and resubmit. Apologies if this is a hassle, I'm just playing with antispam methods right now. If this insists on not working, please email me about it.

Name (required)
E-mail (optional, if you want me to be able to email you back)
URL (also optional)
Comment: