[Remind-Fans] accepting dates/times in more English format

Tim Chase remind at tim.thechases.com
Thu Jan 17 12:15:55 EST 2019


On 2019-01-17 11:52, Dianne Skoll wrote:
> On Thu, 17 Jan 2019 11:32:46 -0500
> "Ian! D. Allen" <idallen at idallen.ca> wrote:
> 
> > Is there a way I can make Remind accept that date/time syntax for
> > use in tzconvert(), or do I really have to manually convert every
> > entry to Remind's DATETIME format of 'YYYY/MM/DD at HH:MM' ?  
> 
> Unfortunately, the conversion must be done outside of Remind;
> there's no built-in way to do it.
> 
> Something like:
> 
> perl -ane 'print "REM $F[0] $F[1] AT $F[2] MSG " . join(" ",
> @F[3..$#F]) . "\n"'
> 
> will accept stdin and write out something acceptable to Remind on
> stdout, at least for the examples on the web page you cited.

It gets a little tricker since the format appears to be in two
columns so you might have to pre-process it to split it into
one row for the Perigee and one row for the Apogee.  But riffing on
your suggestion and assuming the P/A data has been saved in
"pa.txt", :

 sed 's/^\(.\{33\}\) *\(.*\)/\1 Perigee\n\2 Apogee/' pa.txt | \
 awk '(0+$2) > 0{print "REM", $1, $2, "AT", $3, "MSG %\"" $NF "%\""};'

should come pretty close.  It discards the extra information between
the timestamp and the P/A tag, but that can be added back in using
the other fields ("$4"..."$(NF-1)") if they're wanted.

Also, it doesn't *need* a temporary file if you have it in your
system clipboard and have xclip/xsel/pbpaste available, you can just
select/copy it and do

 xsel -o | \
 sed 's/^\(.\{33\}\) *\(.*\)/\1 Perigee\n\2 Apogee/' | \
 awk '(0+$2) > 0{print "REM", $1, $2, "AT", $3, "MSG %\"" $NF "%\""};'

A similar "split the chart so each is on its own line" can be done
with the new/full moon chart, but IIRC remind(1) handles this
internally already with the moondate() function, so no need to reach
for munging the external data-source.

This doesn't resolve timezone issues, but I'm not clear on what
you're intending to do there.

-tim






More information about the Remind-fans mailing list