Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > .mbox format / recovery tools ?

.mbox format / recovery tools ?
Thread Tools
Brit Ben
Mac Enthusiast
Join Date: Apr 2001
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Nov 12, 2001, 04:07 PM
 
Hi all,

Do any of you know of any .mbox format recovery / reformat tools. In particular, I am looking for a sort utility, a message split utility, and a message merge utility, as well as some way to cnvert those horrible PC '^M' to CRLF.

Ideas and comments appreciated.

Thanks,
Ben.
     
<pjmm>
Guest
Status:
Reply With Quote
Nov 13, 2001, 09:11 AM
 
Originally posted by Brit Ben:
<STRONG>
Do any of you know of any .mbox format recovery / reformat tools. In particular, I am looking for a sort utility, a message split utility, and a message merge utility, as well as some way to cnvert those horrible PC '^M' to CRLF.
</STRONG>
This might sound weird, but if you're looking to be playing with mbox files I'd thoroughly recommend installing "mutt". (You probably need to install "ncurses" first.) www.osxgnu.org has versions of both, and doubtless other repositories have also. Yes, it's a terminal based mail client, but it has *great* facilities for sorting messages and limiting messages displayed to those (for example) containing a string matching a regular expression in the body, or the headers, or matching date criteria.

Of course you need to have functioning mbox format mail files beforehand! As to your second query, the following should take care of that pretty easily. (Open a terminal window, move to the directory containing your "contaminated" file "mailfile", and enter...)

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>perl -pi -e 'tr/\<font color = blue>015</font>//' mailfile</font>[/code]

(Note that if you are getting the ^M's from a mac file you'll want to substitute for \012 in the above transliteration: in this situation the text file will look like one big long line. So use...

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>perl -pi -e 'tr/\<font color = blue>015</font>/\<font color = blue>012</font>/' mailfile</font>[/code]

[[Old time unix folk will probably balk at using perl for something that "tr", the unix standalone utility, could do by itself, but the former has the distinct advantage of not producing a copy of the original file. If you want to try this out without overwriting your original file then

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>tr -d '\<font color = blue>015</font>' &lt;mailfile &gt;mailfile.new</font>[/code]

will write mailfile.new without the dreaded "^M"'s everywhere.

tr '\015' '\012' &lt;mailfile &gt;mailfile.newer[/CODE]

will convert a file with mac line endings to one ("mailfile.newer") with the required line feeds (the unix convention). As per usual, you'll probably want to play around with a few non-critical test files first!

Cheers,
Paul
     
rkt
Mac Enthusiast
Join Date: Oct 2000
Status: Offline
Reply With Quote
Nov 13, 2001, 11:17 AM
 
Originally posted by &lt;pjmm&gt;:
<STRONG>...will convert a file with mac line endings to one ("mailfile.newer") with the required line feeds (the unix convention). As per usual, you'll probably want to play around with a few non-critical test files first!</STRONG>
you might also want to try "native2ascii" tool installed by the devtools (i think - it's part of javac). dunno if it fixes windows-style line endings, but it definitely fixes mac-style ones. you can simply use it like this:

cat myFile &gt; native2ascii &gt; myFile-fixed
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:35 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,