home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # kal2pcal: Convert kal appointment file to pcal format.
- # Weekly reminders are *not* included.
- # Cat's .calendar file also, if it exists.
- # Output to stdout.
- #
- # George Ferguson, ferguson@cs.rochester.edu, 8 Jun 1990.
- # New (one file) kal format, 7 Nov 1990.
- #
-
- case $# in
- 0) apps=$HOME/.appoints ;;
- 1) apps=$1 ;;
- *) echo 'usage: kal2pcal [appoints]' >&2
- exit ;;
- esac
-
- cal=${CALENDAR:-$HOME/.calendar}
- if test -f $cal
- then
- cat $cal
- fi
-
- awk '
- BEGIN { mnum["Jan"] = 1
- mnum["Feb"] = 2
- mnum["Mar"] = 3
- mnum["Apr"] = 4
- mnum["May"] = 5
- mnum["Jun"] = 6
- mnum["Jul"] = 7
- mnum["Aug"] = 8
- mnum["Sep"] = 9
- mnum["Oct"] = 10
- mnum["Nov"] = 11
- mnum["Dec"] = 12
- }
- /^ ?[0-9]/ {
- printf "%02d/%02d/%s ",mnum[$2],$1,$3
- for (i=4; i <= NF; i++)
- printf "%s ", $i
- printf "\n"
- }
- ' $apps
-