something like ORIG_DATE=`date -d "7 days ago" +%s` for mail in `find /path/to/mail/dir -type f` do DATE_STRING=`grep -m1 ^Date $mail | cut -d: -f 2-` MAIL_DATE=`date -d "$DATE_STRING" +%s` if [ $MAIL_DATE -gt $ORIG_DATE ] then mv $mail /some/path fi done
no guarantees, particularly because I have not tested it, but the idea is to get 2 unix time stamps, see if the one from each mail is bigger than your cut off date, then move accordingly On Thu, Oct 16, 2008 at 2:19 PM, Voytek Eymont <[EMAIL PROTECTED]> wrote: > > On Thu, October 16, 2008 1:39 pm, Jim Donovan wrote: > > Have you tried csplit(1) - set pattern to '^From ' and stand back. You'll > > have to deal with an empty file before the first item. > > > > You say they're sequential so no further processing is required to > > separate old ones. Note that many spams have crazy Date values. > > Jim, thanks > > no, I don't need to spilt a file, this is a Maildir, sorry, I might have > said 'mailbox' meaning a Maildir mail box > > I have abt 50,000 files with date/time stamps sequential as '11:29', > '11:30', '11:30' etc > > 1222219798.M92715P19307V000000000000FD00I0003537F_5855.sbt.net.au > ,S=36316:2,S > -rw-r--r-- 1 vmail vmail 34002 Sep 24 11:29 > 1222219799.M303140P19307V000000000000FD00I00035381_5857.sbt.net.au > ,S=34002:2,S > -rw-r--r-- 1 vmail vmail 517769 Sep 24 11:30 > 1222219800.M489462P19307V000000000000FD00I00035385_5858.sbt.net.au > ,S=517769:2,S > -rw-r--r-- 1 vmail vmail 46269 Sep 24 11:30 > > each email's header appears to be correct; > > so, I'm trying to read each header, if date is within last 7 days, copy it > eslewhere (back to Maildir) > > sorry for using wrong terminology > > >> I have a mailbox with approximately 50,000 emails; > >> > >> > >> when I tried to age the emails with archivemail, archivemail or some > >> part of it couldn't quite cope with size/volume/some unknown aspect, > >> and, 'crashed' on this mailbox > >> > >> > >> perhaps as a result of that, I now have some 50,000 email files > >> sequentaily date/time stamped, some, there is no way of sorting on file > >> date/time stamp (that I can see) > >> > >> I think... that failed procedure might have also duplicated? > >> triplicated? quadrupled? mail volume... > >> > >> the mail headers do have correct date/time > >> > >> how can I copy say the last 7 days worth of emails from the files? > >> > >> like, "if date in the header=last 7 days, copy this file from here to > >> there" > >> > > -- > > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > > > > > > > -- > Voytek > > -- > SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ > Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html > -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html