#!/usr/local/bin/perl -w0777 use strict; ## Scott Wiersdorf ## Created: Thu Apr 8 22:58:49 MDT 2004 ## $Id: mail_newer2,v 1.1 2005/08/15 18:25:30 scott Exp $ ## print mail message if it's newer than $days ## ## usage: cat message | mail_newer ## or : mail_newer < message ## multiple messages: formail -s mail_newer < mbox ## ## where is the number of days use HTTP::Date qw(str2time); my($days, $msg) = (shift, <>); my($date) = $msg =~ /^From \S+\s+(.+)$/m; do { print $msg; exit } unless $date; print $msg if str2time($date) >= time - ($days*24*60*60);