You don't need perl ...
#!/bin/sh
reduce_detail () {
# convert each detail file entry to a single line
sed -e '1h' -e '1d' \
-e '$x' -e '$b C' \
-e '/^[MTWFS]/x' -e '/^[MTWFS]/b C' \
-e '/^ /H' \
-e 'd' \
-e ': C' \
-e 's/\n /|/g'
}
sort_detail () {
sort -n +2 -5
}
xpand_detail () {
# expand single lines back to multi-line entries
sed -e 's/|/\
/g' \
-e '/Acct-Delay-Time/a\
'
}
cat $* | reduce_detail | sort_detail | xpand_detail
Concise and fast, and except for the sort I had the pieces lying
around. This sorting doesn't cross month boundaries properly.
Somewhere around here I have a sort_detail that does, but I can't
locate it at the moment.
There are tabs in this, so if your /bin/sh is really bash, you might
need the first line to be
#!/bin/sh -nolineediting
-- Dick St.Peters, stpeters@NetHeaven.com Gatekeeper, NetHeaven, Ballston Spa, NY, 1-800-910-6671 (voice) Albany/Saratoga/Glens Falls/North Creek/Lake Placid/Blue Mountain Lake First Internet service based in the 518 area code