Count log Entries


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Count log Entries
# 1  
Old 04-04-2003
Count log Entries

Hi guys,

I have a log file that looks like this
Date Time Act Big Con
01/01/02 01:01:01 12 20 -34
01/23/03 01:23:42 21 -8 22
02/21/03 09:34:32 -87 33 29

I need to count how many positive entries were made within a give date range per column (i.e per Act, Big, Con).

Does anyone has any idea on how to go about this?

Thanks,

Odogbolu98
# 2  
Old 04-04-2003
Of course, but it depends on your system, the tools you're using (for example, GNU `date` has more features than standard UnixWare `date`), and whether or not the file has the same format every time...
# 3  
Old 04-04-2003
Thanks LF,

The tool I am using is Korn Shell and we are really stress on the box right now that performance is fast becoming an issue.

Any help on this issue will be highly appreciated.
# 4  
Old 04-04-2003
You still didn't provide very much extra info though..

Is the format of every line in the log file the same as the few lines you've shown? Are the words Date Time Act Big Con actually on the first line of the file? Try explaining in as much detail what you'd like this program to do and how you'd like it to do it as you've got laid out in your mind.. Why'd you decide you'd like to be able to search between a range of dates? Why are you adding only the positive numbers (and what do Act Big and Con even mean)?

Just a few questions that will hopefully make it easier for everyone to help you make a script that does what you want..
# 5  
Old 04-08-2003
Thanks oombera,

The data I provided was just a sample one, but here is a real live data.

Date Time W220A WI220B W220C W223A
3/26/2003 0:00:04 1 1 1 7
3/26/2003 0:15:02 1 1 2 8
3/26/2003 0:30:03 1 1 1 47
3/26/2003 0:45:01 1 0 1 6
3/26/2003 1:00:03 1 4 1 -7
3/26/2003 1:15:02 27 7 1 4
3/26/2003 1:30:02 1 1 1 8
3/26/2003 1:45:02 1 1 2 6
3/26/2003 2:00:03 1 -1 1 6
3/26/2003 2:15:00 1 1 1 8

The is log file for indicating the date and time of polls for each transaction indiated about. W220A - W223A are all transaction names. What I plan to do, is to count all the positive entries per transaction for the month and indicate the number of success(i.e 80% succes poll for W220A, etc). I hope this help.

I will appreciate any help or clue as to the most efficient way to do this.

Thanks,

Odogbolu98
# 6  
Old 04-08-2003
Here is an example of how to read the file and select only the lines for a given month:
Code:
#! /usr/bin/ksh
givenmonth=3
exec < datafile
read titleline
while read Date Time W220A WI220B W220C W223A ; do
        month=${Date%%/*}
        ((month != givenmonth)) && continue
        echo $Date $W220A $WI220B $W220C $W223A
done
exit 0

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use awk to count and rearrange entries

How can I use awk to count the occurrence of field 2 and rearrange the output like below: Input: OA1 FM AA OA0 FM CC ON0 FM CC FN1 FN BB OY1 FN BB OY2 FN CC OY3 FN CC YT0 FM AA KW1 FN CC KW3 FM BB YT4 FM AA FN2 FT BB OA3 FT AA ON7 FM BB (14 Replies)
Discussion started by: aydj
14 Replies

2. Shell Programming and Scripting

Count from the log file

I have a logfile which would be generated for every process and the log file looks like process1_ddmmyyyy_hhmmss.log ..there would be a log file generated after completion of the process but that would have a different name based on the timestamp. I can use ls -1 -rt | tail -1 but this would... (1 Reply)
Discussion started by: halfafringe
1 Replies

3. UNIX for Advanced & Expert Users

Count number of unique patterns from a log file

Hello Everyone I need your help in fixing this issue., I have a log file which has data of users logging in to an application. I want to search for a particular pattern in the log ISSessionValidated=N If this key word is found , the above 8 lines will contain the name of the user who's... (12 Replies)
Discussion started by: xtechkid
12 Replies

4. Shell Programming and Scripting

Need to count files & create log of that.

Hi Friends, I need some help. First look at my files hierchachy /<level-1>/<level-2>/<level-3>/*.tif eg. : /2010-07-01/AFFIDAVIT-OF-SERVICE---FOR-SC/001/Babylon2_20100701012049_1278004849.49892_000.tif... (2 Replies)
Discussion started by: paragnehete
2 Replies

5. Shell Programming and Scripting

Count of matched pattern occurences by time in a log file

We have a log file, the format is similar to this: 08/04/2011 05:03:08 Connection Success 08/04/2011 05:13:18 Connection Success 08/04/2011 05:23:28 Connection Fail 08/04/2011 05:33:38 Connection Success 08/04/2011 06:14:18 Connection Success 08/04/2011 06:24:28 Connection Fail 08/04/2011... (6 Replies)
Discussion started by: clu
6 Replies

6. Shell Programming and Scripting

Count number of Nodes created and write it to a Log file

Dear Experts, I have to count the number of AddressRecords formed in bbc.xml file using unix script file. For example: for below pasted file, I need to write an output to a log file as "No. of Address Records Created=4". Snippet of bbc.xml:- <?xml version="1.0" encoding="UTF-8" ?> -... (1 Reply)
Discussion started by: phani333
1 Replies

7. Shell Programming and Scripting

awk script to count percentage from log file

Hi, I have a log like this : actually i want to get the log like this : where % can get from : 100 * pmTotNoRrcConnectReqSucc / pmTotNoRrcConnectReq Thanks in advance.. :) (8 Replies)
Discussion started by: justbow
8 Replies

8. Shell Programming and Scripting

How to collect count of a column from log file??

Hi All, I have an Output from a log file which is something like as follows.. ***** CDR and SDR Statistics**** Wed Feb 25 00:05:00 EST 2009 *********CDR and SDR QUEUE STATUS***** Queue busy wait msgs cdr 2 2 4 sdr ... (3 Replies)
Discussion started by: nirmal84
3 Replies

9. Shell Programming and Scripting

taking count of log files and den performing some actions

hi, I've some log files in a path /SYSTEM/custom/data/MNP/xmlerror as: MNP_PORT_IN_P200902191347563283_20090220181630_err_1.xml MNP_PORT_IN_P200902171717114365_20090220211814_err_2.xml MNP_PORT_IN_P200902191349023233_20090220181923_err_1.xml... (4 Replies)
Discussion started by: ss_ss
4 Replies

10. Shell Programming and Scripting

Help with scritp to count an specific word into a log

Hello my friends, I need to count how many words are into a log file, I'm using: cat logfile | grep 'word' | wc -l Cuz the 'word' appears once per line. But my logfile grow faster and at the end ofthe day is really big, so how i can count the 'word' only from (by example) line 4000 of... (5 Replies)
Discussion started by: lestat_ecuador
5 Replies
Login or Register to Ask a Question