Pattern match and counting script -->how to write ?
LQ Suggestions & FeedbackDo you have a suggestion for this site or an idea that will make the site better? This forum is for you.
PLEASE READ THIS FORUM - Information and status updates will also be posted here.
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.
Pattern match and counting script -->how to write ?
Hi Group,
See the following log file of apache (HTTPD).
I want a script which can calculate the busiest date. This file is long (very long) with the lines below:
I can do it with grep command as below, which works perfectly:
# less access.log |grep -c 03/Jan/2005
03
but with this I need to put the pattern manualli i.e. 03/Jan/2005.
Is there a good way to write this script which will automatically give me a busyiest day of the year. the file has more then 4 yrs access record so its only possible with a good script.
In general, I wouldn't try to use a shell script to do this. However, in perl, it is only a few lines of code to parse an Apache log file. There are other equally suitable languages for the task. An alternative might be to use a ready-made log file analyzer.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.