On 11 Dec 2002 at 21:06, Peter S Tillier wrote:
> Literal translation follows (untested):
>
You are the geek! :)
It worked exactly like "msplit.pl".
I made some modifications. Code follows:
#!/bin/awk
# msplit splits a unix mailbox file into many separate files.
# msplit.awk
# Run as:
# msplit.awk filename num prefix suffix
BEGIN {
num = ARGV[2]
prefix = ARGV[3]
suffix = ARGV[4]
ofile = prefix sprintf("%04d",filenum) suffix
}
/^From / {
nmsgs ++
if (nmsgs > num) {
filenum++
ofile = prefix sprintf("%04d",filenum) suffix
close(ofile)
nmsgs = 0
}
}
{ print > ofile }
Daniel
PS. I'm not sure how the "num" argument can be used...