cutting mail spool

Craig White craigwhite at azapple.com
Fri Jul 29 11:43:34 MST 2005


On Fri, 2005-07-29 at 11:36 -0700, Craig White wrote:
> On Fri, 2005-07-29 at 11:27 -0700, Lynn David Newton wrote:
> > Using dd to cut a large mail spool file blindly cuts it
> > at some random place. It would be better to split it at
> > the beginning of messages. An email message begins with
> > the string "^From ".
> > 
> > I played a couple of minutes with csplit(1) (context
> > split), which looks like a possibility, and used to
> > understand, but it's been 10-15 years since I've used
> > it for anything, and couldn't quite make it work. But
> > I'll bet with a little experimentation you could use
> > that to divide the file into multiple spool files.
> ----
> random was OK - I'll not elaborate but the cost is one of 11,210 emails.
> Seems a fair price to pay.
> 
> Thanks for the fish - I was too panicked to research. My mind went to dd
> but I didn't know skip option.
> 
> FTR...
> 
> dd if=big.mailbox of=new.file bs=1048576 count=1000
> OK
> 
> dd if=big.mailbox of=other.part bs=1048576 seek=1000
> Not OK (gave me 2.9G file)
> 
> but
> dd if=big.mailbox of=other.part bs=1048576 skip=1000
> 
> was the winner - thanks all (actually my number was 1073737, which was
> 1/2 rounded upwards)
----
one more issue I guess and this is probably simple...

The second file has a bunch of binary stuff at the top.

The file is still too large to edit with emacs and I just tried to open
it with vi which appears to be larger than it can stomach - it's hanging
there trying to open it for editing... ;-)

Is there a command that I can just cut from the start of the file until
the first ^From ?

Craig



More information about the PLUG-discuss mailing list