Question regarding the "SORT" command

Question regarding the "SORT" command

Post by jb » Tue, 09 Jan 2001 22:10:56



Hi,

I need to combine several log files into one cohesive file that is organized
by date and time.  These log files are webserver access_log files and I
would like the summary file sorted by the access date and time data in the
logfiles.  I believe the SORT command, used with the -k extension, can be
used to do this, but I haven't been able to get this to work.  If anyone has
any information that can help me, I would greatly appreciate it.

Thanks in advance,

JB

 
 
 

Question regarding the "SORT" command

Post by Donald WHIZZARD Lamber » Tue, 09 Jan 2001 23:25:09


Why not a quick perl script ?

        -- Donnie


> Hi,

> I need to combine several log files into one cohesive file that is organized
> by date and time.  These log files are webserver access_log files and I
> would like the summary file sorted by the access date and time data in the
> logfiles.  I believe the SORT command, used with the -k extension, can be
> used to do this, but I haven't been able to get this to work.  If anyone has
> any information that can help me, I would greatly appreciate it.

> Thanks in advance,

> JB

--

CEO / MIS / Owner / Net Admin
INTERNIC: DL1625  ARIN: DL205-ARIN
Provisionet Distributions -- Canada
HTTP://Ca.Provision.Net
The Key is Knowledge, The Distribution method is Provisionet.

 
 
 

Question regarding the "SORT" command

Post by Joerg Morbitze » Tue, 09 Jan 2001 23:21:54



> Hi,

> I need to combine several log files into one cohesive file that is organized
> by date and time.  These log files are webserver access_log files and I
> would like the summary file sorted by the access date and time data in the
> logfiles.  I believe the SORT command, used with the -k extension, can be
> used to do this, but I haven't been able to get this to work.  If anyone has
> any information that can help me, I would greatly appreciate it.

> Thanks in advance,

> JB

If the timestamp in all logfiles look exactly the same than
simply do a "cat file1.log file2.log file3.log | sort".
If not then you need to write a small awk or perl script...

        Joerg.

 
 
 

Question regarding the "SORT" command

Post by Bill Touchsto » Wed, 07 Mar 2001 10:40:50


I am assuming that the log files have the date & time in space delimited
fields. The problem is that columns tend to shift as the data is rarely
printed in a hard columnar fashion. i.e 1/1/1 vs 12/14/99. Sort -k requires the
fields to start and end on the same column. Perl is useful - so is awk if you
understand it. If you were to publish some sample lines from your logfile - I
could assist with that if you haven't solved it thus far.

Bill



Quote:

>Hi,

>I need to combine several log files into one cohesive file that is organized
>by date and time.  These log files are webserver access_log files and I
>would like the summary file sorted by the access date and time data in the
>logfiles.  I believe the SORT command, used with the -k extension, can be
>used to do this, but I haven't been able to get this to work.  If anyone has
>any information that can help me, I would greatly appreciate it.

>Thanks in advance,

>JB