This probably seems basic to most everyone here, but I could use some advice.
I have a script that will download my Google calendar in ics format and convert it to remind format.
That is cool, but I'd like the script, that I run as a cron job, to add some strings to the beginning of the remind file that is generated by the script that converts the ics file to a remind file.
Then before the script is done I want it to add the following to the end of each of the lines that come below (or after) the five listed above.
FSET _days(x) iif(x>1, x + " days", x==1, "1 day", "")
FSET _hrs(x) iif(x>1, x + " hours", x==1, "1 hour", "")
FSET _mins(x) iif(x>1, x + " minutes", x==1, "1 minute", "")
FSET _smush(x, y) iif(x != "" && y != "", x + " and " + y, x + y)
FSET _countdown(x) _smush(_smush(_days(x/1440), _hrs((x - 1440*(x/1440))/60)), _mins(x%60))
I'd like the following added to each line:
Basically, this should give me a running countdown until a reminder in remind is due. Below is the bash script I have so far. (Beware, it is ugly and not at all well written.)
b (in [_countdown(trigdatetime()-current())])
I figured out a way to make this work.
cat /home/grouchygaijin/basic.ics | /home/grouchygaijin/scripts/ical2rem.pl > ~/.ical2rem
sed -e 's/$/ (in [_countdown(trigdatetime()-current())])/' -i ~/.ical2rem
cat ~/file ~/.ical2rem > temp-file
mv temp-file ~/.ical2rem