02-25-2009
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 2 0 2
******CWAY CROSS STATISTICS***********
name state last op busy%
cdr.140 busy 0:05.11 68.3
cdr.141 busy 0:06.42 59.6
cdr.142 free 0:07.80 42.9
cdr.143 free 0:08.26 33.0
cdr.144 free 0:14.64 20.9
cdr.145 free 0:10.72 14.0
cdr.146 free 0:32.41 9.5
cdr.147 free 0:16.32 7.1
sdr.150 busy 0:06.31 69.8
sdr.151 free 0:02.74 59.3
sdr.152 busy 401.60 48.1
sdr.153 free 0:03.02 37.1
sdr.154 free 0:19.02 26.8
sdr.155 free 0:19.67 19.9
sdr.156 free 0:07.48 15.4
sdr.157 free 1108.35 13.0
sdr.158 free 0:17.44 9.8
sdr.159 free 0:13.70 8.3
sdr.160 free 0:20.50 7.1
sdr.161 free 0:14.14 6.1
This info is written to the log file every 5 minutes(same as the above one).
Requirement:
I need to get the count of the msgs for CDR and SDR Induvidually every hour in a sperate file .Is there an way to do this by some script.The name of the log file is mg_stat.log
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have to send a file to mainframe and before sending it, I have to execute the quote command to set the record length.
Since the file is dynamic, I do not know what the maximum size of a line could be.
Currently, I use the following function to get the Max Column Count. Since I use "sed" it... (2 Replies)
Discussion started by: gemini
2 Replies
2. Red Hat
Hi,
I heard a command that can collect all RHEL 5 log in a single compress file before I forget.
Does any body know...What the command is ?
Thanks. (4 Replies)
Discussion started by: nnnnnnine
4 Replies
3. Shell Programming and Scripting
I have a comma (,) delimited file.
106232145,"medicare","medicare,medicaid",789
I would like to count the number of fields in each line.
I tried the below code
awk -F ',' '{print NF-1}'
This returns me the result as 5 instead of 4. This is because the awk takes... (9 Replies)
Discussion started by: machomaddy
9 Replies
4. UNIX for Dummies Questions & Answers
Hey everyone!
I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column.
my input file is like this:
ID1 1 10M AAATTTCCGG
ID2 5 4M ACGT
ID3 5 8M ACCTTGGA
ID4 5 ... (7 Replies)
Discussion started by: @man
7 Replies
5. Shell Programming and Scripting
Hi. I am not sure the title gives an optimal description of what I want to do. Also, I tried to post this in the "UNIX for Dummies Questions & Answers", but it seems no-one was able to help out.
I have several text files that contain data in many columns. All the files are organized the same... (14 Replies)
Discussion started by: JamesT
14 Replies
6. Shell Programming and Scripting
I have a text file that has the following column data:
0.007
0.005
0.004
0.007
How do i output the total sum of the data above? (6 Replies)
Discussion started by: alegnagrp
6 Replies
7. Shell Programming and Scripting
I need to collect last 2 days data from /var/log/messages into a separate file (file format: flmessagetimedaymonth). I have collect today's month, date, time information in separate variable. Please help me in this issue (Probably need awk and grep function).
month=$(date|awk '{print $2}')... (4 Replies)
Discussion started by: makauser
4 Replies
8. Shell Programming and Scripting
Hello all,
I would like to ask your help here:
I've a huge file that has 2 columns. A part of it is:
sorted.txt:
kss23 rml.67lkj
kss23 zhh.6gf
kss23 nhd.09.fdd
kss23 hp.767.88.89
fl67 nmdsfs.56.df.67
fl67 kk.fgf.98.56.n
fl67 bgdgdfg.hjj.879.d
fl66 kl..hfh.76.ghg
fl66... (5 Replies)
Discussion started by: Padavan
5 Replies
9. Shell Programming and Scripting
Hi All,
let's say an input looks like:
C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11
----------------------------------
1|0123452|C501|Z|Z|Z|E|E|E|E|E|E|E
1|0156123|C501|X|X|X|E|E|E|E|E|E|E
1|0178903|C501|Z|Z|Z|E|E|E|E|E|E|E
1|0127896|C501|Z|Z|Z|E|E|E|E|E|E|E
1|0981678|C501|X|X|X|E|E|E|E|E|E|E
... (6 Replies)
Discussion started by: suresh_target
6 Replies
10. UNIX for Beginners Questions & Answers
I have a file abc.csv, from which I need column 24(PurchaseOrder_TotalCost) to get the sum_of_amounts with date and row count into another file say output.csv
abc.csv-
UTF-8,,,,,,,,,,,,,,,,,,,,,,,,,
... (6 Replies)
Discussion started by: Tahir_M
6 Replies
LEARN ABOUT DEBIAN
sdrstring
ici::doc::pod3::sdrstring(3) ICI library functions ici::doc::pod3::sdrstring(3)
NAME
sdrstring - Simple Data Recorder string functions
SYNOPSIS
#include "sdr.h"
Object sdr_string_create (Sdr sdr, char *from);
Object sdr_string_dup (Sdr sdr, Object from);
int sdr_string_length (Sdr sdr, Object string);
int sdr_string_read (Sdr sdr, char *into, Object string);
DESCRIPTION
SDR strings are used to record strings of up to 255 ASCII characters in the heap space of an SDR. Unlike standard C strings, which are
terminated by a zero byte, SDR strings record the length of the string as part of the string object.
To store strings longer than 255 characters, use sdr_malloc() and sdr_write() instead of these functions.
Object sdr_string_create(Sdr sdr, char *from)
Creates a "self-delimited string" in the heap of the indicated SDR, allocating the required space and copying the indicated content.
from must be a standard C string for which strlen() must not exceed 255; if it does, or if insufficient SDR space is available, 0 is
returned. Otherwise the address of the newly created SDR string object is returned. To destroy, just use sdr_free().
Object sdr_string_dup(Sdr sdr, Object from)
Creates a duplicate of the SDR string whose address is from, allocating the required space and copying the original string's content.
If insufficient SDR space is available, 0 is returned. Otherwise the address of the newly created copy of the original SDR string
object is returned. To destroy, use sdr_free().
int sdr_string_length(Sdr sdr, Object string)
Returns the length of the indicated self-delimited string (as would be returned by strlen()), or -1 on any error.
int sdr_string_read(Sdr sdr, char *into, Object string)
Retrieves the content of the indicated self-delimited string into memory as a standard C string (NULL terminated). Length of into
should normally be SDRSTRING_BUFSZ (i.e., 256) to allow for the largest possible SDR string (255 characters) plus the terminating NULL.
Returns length of string (as would be returned by strlen()), or -1 on any error.
SEE ALSO
sdr(3), sdrlist(3), sdrtable(3), string(3)
perl v5.14.2 2012-05-25 ici::doc::pod3::sdrstring(3)