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.