只是用formail.formail是一个程序,可以处理邮箱,为邮箱中的每个邮件运行一些操作,单独的邮件等.
更多信息:http://www.manpagez.com/man/1/formail/
如果您只想将邮箱拆分为单独的文件,我会建议这样的解决方案:
$ cat $MAIL | formail -ds sh -c 'cat > msg.$FILENO'
Run Code Online (Sandbox Code Playgroud)
来自男人:
FILENO
While splitting, formail assigns the message number currently
being output to this variable. By presetting FILENO, you can
change the initial message number being used and the width of the
zero-padded output. If FILENO is unset it will default to 000.
If FILENO is non-empty and does not contain a number, FILENO gen-
eration is disabled.
Run Code Online (Sandbox Code Playgroud)
小智 6
Git也可以做到这一点,例如
wget ftp://lists.gnu.org/bug-tar/2014-09
git mailsplit -o. 2014-09
Run Code Online (Sandbox Code Playgroud)
如果你没有 formail,你也可以使用这个 Perl oneliner(从这里复制,刚刚在我需要拆分的 Thunderbird 收件箱上测试)
perl -pe 'open STDOUT, ">out".++$n if /^From /' < $IN > before_first
Run Code Online (Sandbox Code Playgroud)
或者,有 0 填充的数字:
perl -pe 'open STDOUT, sprintf(">m%05d.mbx", ++$n) if /^From /' < $IN > before-first
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6639 次 |
| 最近记录: |