Help sorting file.

Hi,
I have this file (filex)
07-11-2003 10:11:12!cccc!ddd!eeeeeeee
07-11-2003 09:11:11!dddd!kkkkk!xxxxxx
09-12-2003 14:18:43!aaaa!bbbbb!cccc

where I need to sort it by date+time in this order:

09-12-2003 14:18:43!aaaa!bbbbb!cccc
07-11-2003 10:11:12!cccc!ddd!eeeeeeee
07-11-2003 09:11:11!dddd!kkkkk!xxxxxx

I have used this command but the result is wrong.

cat filex | sort -t! +0 -1

Any help will be well appreciated.

Regards,

  Giovanni

add a option -r in your sort command

Thanks!! Now it is perfect!

Giovanni

That works fine unless you're dealing with multiple years... :slight_smile: