Here is some examples script for iCalFilter (either plain iCalFilter script, using it directly as interpreter, or shell script using iCalFilter).

Busify

This script provides a calendar with only free/busy information, by removing all data on each event except dates of start and end, and replace the summary by "Busy".

busify:

#! icalfilter -e

# expand reccuring events
:expand

# remplace summary
s/SUMMARY/Busy/

# keep only dtstart, dtend and summary fields
/DTSTART|DTEND|SUMMARY/f

Usage:

$ busify input.ics > output.ics

Purge old events

This script remove all events older than a month in a calendar.

purgeold:

#! icalfilter -e

# keep events more recent than a month old
/>-1m/

Usage:

$ purgeold input.ics > purged.ics

Display events of a week

This script output a nice console display for all events of the week. You must edit the script to choose the calendar to be displayed, and eventually how colors are choosen.

calweek:

#!/bin/sh

# display events for the week $1 (default: 0)

if [ $# -eq 0 ]
then
    week=+0
else
    week=$1
    shift
fi

cals="/path/to/cal1.ics \
      /path/to/cal2.ics \
      /path/to/cal3.ics"

# random color choice
color="-c"

# color using a configuration file
# format of the file:
#   filenamemotif: colorname
#color="-C /path/to/colorconf.cfg"

exec icalfilter -H $color "/=${week}w/;:expand;/=${week}w/t" $cals

Usage:

$ calweek           # display the current week
$ calweek +1        # display the next week
$ calweek -1        # display the previous week

Display events of a day

The same as the last one, but only for one day.

calday:

#!/bin/sh

# display events for the day $1 (default: 0)

if [ $# -eq 0 ]
then
    day=+0
else
    day=$1
    shift
fi

cals="/path/to/cal1.ics \
      /path/to/cal2.ics \
      /path/to/cal3.ics"

# random color choice
color="-c"

# color using a configuration file
# format of the file:
#   filenamemotif: colorname
#color="-C /path/to/colorconf.cfg"

exec icalfilter -H $color "/=${day}d/;:expand;/=${day}d/t" $cals

Usage:

$ calday           # display the current day
$ calday +1        # display the next day
$ calday -1        # display the previous day