#!/bin/sh
# Needed a way to sort an apache log file recently after combining multiple
# log files and the records were no longer ordered by date. This is the script
# I came up with, but I can’t remember where I got it from.
if [ ! -f $1 ]; then
    echo "Usage: $0 "
        exit
	fi
	echo "Sorting $1"
#sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n $1 > $2 
sort -k 4.9b,4.12n -k 4.5b,4.7M -k 4.2b,4.3n -k 4.14b,4.15n -k 4.17b,4.18n -k 4.20b,4.21n $1 > $2
