#!/bin/sh
#
# sort pivoting yy year at beginning of line around 1970
#
# initial single-word args beginning with + or - are given to sort
# alternatively pass more complicated args to sort via $SORTARGS directly
#
# Corey Satten, corey @ cac.washington.edu, 3/10/00
# http://staff.washington.edu/corey

for i in ${1+"$@"}; do
    case "$1" in
	[-+]*) SORTARGS="$SORTARGS $1"; shift;;
	    *) break;;
    esac
done

sed 's/^\([0-6][0-9]\)/20\1/; s/^\([789][0-9]\)/19\1/' ${1+"$@"} |
    sort $SORTARGS |
	sed 's/^20//; t
	     s/^19//; t
	     '
