Splitting a Large Mailbox into multiple files

By using formail – we can split a large mailbox into multiple small one easily.

+skip
Skip the first skip messages while splitting.

-total
Output at most total messages while splitting.

 

The following command will output the first 10 messages into mailbox.1 and the next 10 messages to the mailbox.2, etc etc.

cat mailbox | formail -10 -s > mailbox.1
cat mailbox | formail +10 -10 -s >mailbox.2
cat mailbox | formail +20 -10 -s >mailbox.3

 

Leave a Reply