[Remind-Fans] Sliding calendar starting from today ? (continued)

Derek derekmthomas at telus.net
Sat Jun 25 13:06:48 EDT 2011


# ...Cleaned up just a little bit: 

BEGIN{
  color["default"]="7" # white
  color["work"]="1" # red
  color["home"]="2" # green
  color["play"]="3" # yellow
  color["family"]="4" # blue
  color["friends"]="5" # magenta
  color["market"]="6" # cyan
  categ_re="category: [^ ][^ ]* *"
}
{
  printf $1
  msg=substr($0, index($0, " "))
  match(msg, categ_re)
  split(substr(msg, RSTART, RLENGTH), categ, " ")
  printf("\033[3%sm", \
    categ[2] > 0 ? color[categ[2]] : color["default"])
  sub(categ_re, "", msg)
  printf("%s\033[3%sm\n", msg, color["default"])
}



More information about the Remind-fans mailing list