G
grocery_stocker
If I have a file in the following format:
lar ttyp2 216.106.179.129 Fri Nov 17 17:12 - 17:14
(00:01)
lar ttypa 216.106.179.129 Fri Nov 17 15:53 - 15:55
(00:01)
lar ttypp 216.106.179.129 Thu Nov 16 17:11 - 17:21
(00:09)
lar ttypk 216.106.179.129 Thu Nov 16 14:20 - 14:21
(00:01)
lar ttypn 216.106.179.129 Thu Nov 16 13:23 - 13:37
(00:13)
irongeek ttypi 216.106.179.129 Wed Nov 15 17:27 - 17:32
(00:04)
sabre ttyp5 216.106.179.129 Wed Nov 15 13:59 - 14:03
(00:04)
lar ttyp5 216.106.179.129 Wed Nov 15 13:57 - 13:59
(00:01)
sabre ttyp5 216.106.179.129 Wed Nov 15 13:28 - 13:57
(00:28)
sabre ttypc 216.106.179.129 Wed Nov 15 12:10 - 12:10
(00:00)
lar ttypd 71.57.146.22 Fri Nov 17 07:27 - 07:43
(00:16)
irongeek ttyp2 71.57.146.22 Thu Nov 16 07:49 - 07:56
(00:07)
sabre ttypg 71.57.146.22 Sat Nov 11 15:56 - 16:09
(00:12)
The stuff before the space is already sorted. After the space break,
the data is sorted again. I want
all the data in this file to be sorted in descending order. I tried
looking at bash sort, but I couldn't
find anything.
I thought maybe I could also do this:
-read in each line
-have the date as the first value, and the reference to the list(?) as
the second value.
-Make the first value the hash key and the reference to the list the
value of the hash key
-sort the hash keys and write back
However, for some reason, this seems a bit overcomplicated.
Ideas?
lar ttyp2 216.106.179.129 Fri Nov 17 17:12 - 17:14
(00:01)
lar ttypa 216.106.179.129 Fri Nov 17 15:53 - 15:55
(00:01)
lar ttypp 216.106.179.129 Thu Nov 16 17:11 - 17:21
(00:09)
lar ttypk 216.106.179.129 Thu Nov 16 14:20 - 14:21
(00:01)
lar ttypn 216.106.179.129 Thu Nov 16 13:23 - 13:37
(00:13)
irongeek ttypi 216.106.179.129 Wed Nov 15 17:27 - 17:32
(00:04)
sabre ttyp5 216.106.179.129 Wed Nov 15 13:59 - 14:03
(00:04)
lar ttyp5 216.106.179.129 Wed Nov 15 13:57 - 13:59
(00:01)
sabre ttyp5 216.106.179.129 Wed Nov 15 13:28 - 13:57
(00:28)
sabre ttypc 216.106.179.129 Wed Nov 15 12:10 - 12:10
(00:00)
lar ttypd 71.57.146.22 Fri Nov 17 07:27 - 07:43
(00:16)
irongeek ttyp2 71.57.146.22 Thu Nov 16 07:49 - 07:56
(00:07)
sabre ttypg 71.57.146.22 Sat Nov 11 15:56 - 16:09
(00:12)
The stuff before the space is already sorted. After the space break,
the data is sorted again. I want
all the data in this file to be sorted in descending order. I tried
looking at bash sort, but I couldn't
find anything.
I thought maybe I could also do this:
-read in each line
-have the date as the first value, and the reference to the list(?) as
the second value.
-Make the first value the hash key and the reference to the list the
value of the hash key
-sort the hash keys and write back
However, for some reason, this seems a bit overcomplicated.
Ideas?