Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting logfiles

Status
Not open for further replies.

SirB

IS-IT--Management
Oct 23, 2008
8
US
Hi all,

I am a Unix newby and need some help on this one:

This logfiles format needs to be sorterd according to time stamp. There can be several logfiles with the same prefix e.g.0001883 but with different timestamps.

The time stamp here is time (15:56,47) and date (18-10-2008).

0001883.de.20081018155647_0.log

I am thankful for any help on that.

rgds
 
ls *.log | sort -t. -k3

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
> The time stamp here is time (15:56,47) and date (18-10-2008).
But is that also the create/modification time of the file as well?

If the actual timestamps are close enough to the timestamp encoded in the filename, then
[tt]ls -lrt *.log
ls -lt *.log[/tt]
should do what you want as well.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Thanks,

that helped.

Kind rgds
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top