I have done a bunch of reading on sorting data and I am still very confused about how to go about it. Maybe thru example of a real problem, I can learn. I have the following file and need to sort the records based on a field. Here is sample data:
server1 01/20/2005 10:04 34.321 42133 denver
server2 01/19/2005 22:12 4.003 250 los angeles
server3 01/15/2005 23:42 52.105 32033 new york
server4 01/20/2005 08:31 14.563 6752 boston
server5 01/21/2005 12:33 17.511 5782 dallas
I would like to sort and print these records so that the 4th field is in descending order and the data returns like this:
server3 01/15/2005 23:42 52.105 32033 new york
server1 01/20/2005 10:04 34.321 42133 denver
server5 01/21/2005 12:33 17.511 5782 dallas
server4 01/20/2005 08:31 14.563 6752 boston
server2 01/19/2005 22:12 4.003 250 los angeles
Can you help as I really do not understand the sort function? Quite a departure from Unix's sort.
LJS
server1 01/20/2005 10:04 34.321 42133 denver
server2 01/19/2005 22:12 4.003 250 los angeles
server3 01/15/2005 23:42 52.105 32033 new york
server4 01/20/2005 08:31 14.563 6752 boston
server5 01/21/2005 12:33 17.511 5782 dallas
I would like to sort and print these records so that the 4th field is in descending order and the data returns like this:
server3 01/15/2005 23:42 52.105 32033 new york
server1 01/20/2005 10:04 34.321 42133 denver
server5 01/21/2005 12:33 17.511 5782 dallas
server4 01/20/2005 08:31 14.563 6752 boston
server2 01/19/2005 22:12 4.003 250 los angeles
Can you help as I really do not understand the sort function? Quite a departure from Unix's sort.
LJS