ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am not very familiar with UNIX scripting.
Can someone give me pointers on how I can achive the
process below?
I need to retrieve the hourly log entries from a daily log file. The log file is generated from VoizBridge server which only can generate daily log file.
For generating the hourly entries, I think I should copy the daily log every hour and do some processing on the latest log and compare with the older log...
This will keep a copy of the last log and put any differences into uniquely-named hourly log files. But note that when the logfile rolls over, you'll end up with an empty file.
Last edited by taylor_venable; 05-12-2006 at 10:21 AM.
Yes, that's correct. And actually, forget what I said about the hourly difference being empty when the logfile gets rolled over; that won't happen. Sorry about that, I should have thought a little bit more before I said it.
If the program that is generating the logfile keeps the logfile open and does not flush pending writes to disk, then you would not be able to get anything from the file until it had been closed. But if that is not the case, you can read the entries from the file which represent the current time-range that you wish, while the log remains open.
As others have said, the cron daemon can execute any sort of scheduled task. There are a variety of tools, such as grep and awk, which are excellent for parsing text-files. (Of the two, awk is much more versatile and deserves the half-hour or so that it takes to bone-up on it...)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.