sorting(both Ascending & Descending) files based on multiple fields

Hi All,

I am encountered with a problem while sorting a file based on multiple columns . I need to sort like:
(field2,ascending) , (field3,ascending) ,(field8,descending) , (field7,ascending),(field13,ascending).

So far i was sorting only in ascending order but here i need to use one descending field also.

Please see the sample text which needs to be sorted based on above rule.The text is TAB delimited.

200902010606	0001319	2113740F35	0	IDEN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113740F39	0	IDEN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113740F67	0	WLAN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113741F25	0	IDEN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113743A19	0	GTSS		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113743K15	0	IDEN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113743L13	0	IDEN		0	0	0	0	0	NULL		AK																					
200902010606	0001319	2113743L17	0	IDEN		0	0	0	0	0	NULL		AK

Previously i was using sort like

sort -t "`echo -e "\t"`" +1 -2 +2 -3 >tmp This sort file using 2nd and 3rd field in ascending order only having TAB as delimiter.

Please help me to sort it out.

Thanks
Neeraj

sort -r reverses the sense of all comparisons.

If you are on linux try msort - it allows you to invert (-i) the sense of the comparison on a field by field basis.

Otherwise you will have to write a sort in perl or C or python... whatever you like.