[Remind-Fans] simple format by days instead of weeks

Ed Blackman ed at edgewood.to
Fri Jul 29 14:44:07 EDT 2011


On Fri, Jul 29, 2011 at 10:02:03AM -0400, David F. Skoll wrote:
>On Thu, 28 Jul 2011 22:31:53 -0600
>Dave Parker <cedardocster at gmail.com> wrote:
>
>> Is there a way to get a similar report for the next fourteen days
>> starting today?
>
>Unfortunately not.  You'd have to ask for three weeks' worth of
>output and then filter out anything earlier than today.

Here's a bash function I use to do something very similar.  It relies on 
the fact that when dates are in YYYYMMDD format, comparing the dates as 
integers has the same result as comparing them chronologically.  It does 
use some bash-specific variable substring enhancements to avoid running 
processes to get the remind output in YYYYMMDD format.

remind_after_today() {
   local today=$(date +%Y%m%d)

   while read date x x x x rest; do
     if [ "${date:0:4}${date:5:2}${date:8:2}" -ge "$today" ]; then
       echo "$date $rest";
     fi
   done
}

Place in the script that calls remind (or your .bashrc if you want to 
use it from the command line).  Use like "rem -s3 | remind_after_today".

-- 
Ed Blackman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.roaringpenguin.com/pipermail/remind-fans/attachments/20110729/c71c5823/attachment.pgp>


More information about the Remind-fans mailing list