Help on Sort command

Hi there,

I have following log files

xsng1344pap_72_20090722.log.bz2
xsng1344pap_74_20090722.log.2.bz2
xsng1344pap_74_20090722.log.3.bz2
xsng1344pap_74_20090722.log.bz2
xsng1346pap_78_20090720.log.1.bz2
xsng1346pap_78_20090720.log.2.bz2
xsng1346pap_78_20090720.log.3.bz2
xsng1346pap_78_20090720.log.4.bz2
xsng1346pap_78_20090720.log.5.bz2
xsng1346pap_78_20090721.log.2.bz2
xsng1346pap_78_20090721.log.5.bz2
xsng1346pap_78_20090721.log.6.bz2
xsng1347pap_57_20090720.log.1.bz2
xsng1347pap_57_20090720.log.bz2
xsng1347pap_57_20090721.log.1.bz2
xsng1347pap_57_20090721.log.bz2
xsng1347pap_57_20090722.log.1.bz2
xsng1347pap_79_20090720.log.2.bz2
xsng1347pap_79_20090720.log.bz2

I would like to sort them based on date and then log / log.1 / log.2 etc, however when i use sort -n the command sorts on based of first numeric occurrence that is server name.

The output i need is something like this
1) Sort based in date 20 July / 21 July / 22 July / accordingly.
2) Sort based on log.bz2 / log.1.bz2 / log.2.bz2 / accordingly.

Is any option with sort? Please help.

sort -k 1.16,1.30 filename

is a start. If I understand your data you not really need -n.

Thanks yes that's what i need.. cheers