On Fri, Dec 25, 2009 at 04:22:34PM +0000, Christian Ebert wrote:
> * Wu, Yue on Friday, December 25, 2009 at 21:12:52 +0800
> > On Fri, Dec 25, 2009 at 11:56:44AM +0000, Christian Ebert wrote:
> >> egrep '^From [-a-za-z0-9....@[-a-za-z0-9]+\.[a-za-z0-9]+ [A-Z][a-z]{2}
> >> [A-Z][a-z]{2} [ 1-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [0-9]{4}$' mbox
> >> | wc -l
> >>
> >> But you might be fine with:
> >>
> >> grep '^From ' mbox | wc -l
> >
> > Thanks, but that's the one part that I want to solve... I'm not familiar
> > with sh
> > script, the script I use for maildir is the follows:
> >
> > mailhier=~/.mutt/mails
> >
> > if [ $(find $mailhier -type f -print | wc -l) -ne 0 ]; then
> > for d in "$mailhier/"*
> > do
> > if [ $(find "$d" -type f -print | wc -l) -eq 0 ]; then
> > rm -r "$d"
> > fi
> > done
> > fi
> >
> > I don't know how to do the same thing in sh script for mbox? Any one can
> > figure
> > me out of it?
>
> Ah, you just want to remove empty mailboxes, then perhaps just
>
> save_empty=no
>
> is enough?
>
> Otherwise something like:
>
> # delete all empty file inside $mailhier
> find $mailhier -type f -size 0 -exec rm -f {} \;
>
Oh! I'm really sorry that I've sent a wrong script! ...
My script does this: count the mails in some particular maildir, then assign the
number to a var:
if [ -d ${mymaildir} -a $(find ${mymaildir} -type f -print | wc -l) -ne 0 ];
then
mailsnew="$(find ${mymaildir}/*/new -type f | wc -l | sed 's/ //g')"
# mails=$(($(find ${mymaildir}/*/cur -type f | wc -l | sed 's/ //g') +
${mailsnew}))
if [ ${mailsnew} -ne 0 ]; then
if [ -d ${mymaildir}/private ]; then
privmailnew="$(find ${mymaildir}/private/new -type f | wc -l | sed
's/ //g')/"
fi
if [ -d ${mymaildir}/inbox ]; then
inmailnew="$(find ${mymaildir}/inbox/new -type f | wc -l | sed 's/
//g')/"
fi
mailsfmt="[${privmailnew}${inmailnew}${mailsnew}]"
fi
fi
But I don't know how to transform this script to suit for mbox mails counting.
--
Hi,
Wu, Yue