Need help sorting a text file
Posted on 2006-12-01
I'm trying sort a log file (text file) from oldest to newest. Each line of the file has an output like:
the <date> format are like the following examples:
Fri Nov 17 06:33:13 PST 2006
Thu Nov 16 15:36:00 PST 2006
Here is an example of a real entry in my log file:
testapp;jhill;11_11-11;st;Tue May 30 12:35:00 PDT 2006;testapp-st-20060530-12:35
Ok so you get the idea.
Here's my issue. I have a log file similar to this on 2 different servers and I want to combine them.
I know i can cat one file and append to the other, but I want to them have in order as far as date. If I append 1 file to the other, what command could i use to sort?
Again, I'm spefically trying to sort the <date> field above. Thanks
One note, I did the following: sort -t\; -k5,5 inputfile , but that it by the time "12:35:00" time in the above example, not the entire date and time as specified in <date>. I'm not even sure if the sort command can do this.