Listing 1: Shell script to sort a tar table-of-contents by date
#! /bin/sh
cut -c41-200 List \
| \
sed -e 's/^[0-9]*//' -e 's/^ *//' \
| \
sed \
-e 's/^Jan/ 1/' \
-e 's/^Feb/ 2/' \
-e 's/^Mar/ 3/' \
-e 's/^Apr/ 4/' \
-e 's/^May/ 5/' \
-e 's/^Jun/ 6/' \
-e 's/^Jul/ 7/' \
-e 's/^Aug/ 8/' \
-e 's/^Sep/ 9/' \
-e 's/^Oct/10/' \
-e 's/^Nov/11/' \
-e 's/^Dec/12/' \
| \
awk '{printf( "%s %2s %2s %s\n", $3, $1, $2, $4 ) }' \
| \
sort \
| \
awk '{printf( "%2s %2s %s %s\n", $2, $3, $1, $4 ) }' \
|\
sed \
-e 's/^ 1/Jan/' \
-e 's/^ 2/Feb/' \
-e 's/^ 3/Mar/' \
-e 's/^ 4/Apr/' \
-e 's/^ 5/May/' \
-e 's/^ 6/Jun/' \
-e 's/^ 7/Jul/' \
-e 's/^ 8/Aug/' \
-e 's/^ 9/Sep/' \
-e 's/^10/Oct/' \
-e 's/^11/Nov/' \
-e 's/^12/Dec/'
|