Sponsored Content
Top Forums Shell Programming and Scripting How to collect count of a column from log file?? Post 302291336 by nirmal84 on Wednesday 25th of February 2009 12:02:10 PM
Old 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

Max column count in a file

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

Does RHEL 5 provide a command to collect RHEL system log in single compress file?

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

Count number of column in a comma delimited file

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

Count the lines with the same values in a column and write the output to a file

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

Advanced: Sort, count data in column, append file name

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

Count column data in a text file

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

Collect last 2 days data from /var/log/messages

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

Read first column and count lines in second column using awk

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

Count of occurrence in particular column of the file.

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

Copy columns from one file into another and get sum of column values and row count

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
LIBFREEIPMI(3)							    LIBFREEIPMI 						    LIBFREEIPMI(3)

NAME
libfreeipmi - FreeIPMI library Introduction Libfreeipmi is the primary library that most of the FreeIPMI tools are based upon. The following describe the sub-sections of the library. api The highest level API provided by libfreeipmi. It abstracts away the details of inband and outofband protocols from the user. It also provides useful error codes for the user to easily interpret IPMI problems. 'api' is used by most FreeIPMI tools and libraries, such as bmc-info(8), ipmi-sensors(8), and libipmimonitoring(3). cmds Provides fiid templates and 'fill' functions for IPMI commands. Also provides macros definining common parameters for IPMI commands. The cmds are used by most other portions of libfreeipmi including the 'api' sub-section and tools such as ipmipower(8) and ipmicon- sole(8). debug Provides various packet/record dumping utility functions. Utilized by the 'api' subsection and by tools such as ipmipower(8) and ipmiconsole(8). driver Provides APIs for in-band IPMI communication. Currently supported drivers are KCS, SSIF, and OpenIPMI. The 'driver' subsction is used by tools such as bmc-watchdog(8) and the 'api' sub-section. fiid The "FreeIPMI Interface Definition" provides an API used for the construction/deconstruction of packets in libfreeipmi. The API works around fiid-templates, which are then used to create fiid-objects. Fiid-templates are used to describe packets through a string-name to bit-field mapping. The API allows users to read/write fields in an object using the string to bit-field mapping. Mar- shalling, packing, endian, and various other network issues are handled within 'fiid'. Fiid objects are used throughout libfreeipmi, including the 'api' sub-section, 'cmds' sub-sections, and various tools. fru-parse Provides an API for parsing Field Replaceable Unit (FRU) records. Utilized by tools such as ipmi-fru(8). interface Provides 'assemble' and 'disassemble' functions for building packets for individual in-band or out-of-band protocols. Also provides all necessary fiid templates, 'fill' functions, and other utility functions necessary to communicate on an IPMI interface. Utilized by the 'api' sub-section and tools such as ipmipower(8) and ipmiconsole(8). interpret Provides an API for interpreting sensor events by mapping them into Nominal, Warning, or Critical states. Utilized by FreeIPMI tools and libraries such as ipmi-sensors(8) and libipmimonitoring(3). locate Provides an API to probe several standards to find default values for in-band IPMI communication. Utilized by the 'api' sub-section and the ipmi-locate(8) tool. record-format Provides macros, fiid-templates, and information on records used in IPMI. Utilized by the 'sdr-cache' subsection and tools like ipmi-sensors(8). sdr-cache Provides an API for creating, caching, reading, and parsing a sensor data repository (SDR). Utilized by tools such as ipmi-fru(8) and ipmi-sensors(8). sdr-parse Provides an API for parsing SDR records. Utilized by tools such as ipmi-fru(8) and ipmi-sensors(8) sel-parse Provides an API for reading and parsing System Event Log (SEL) entries. Utilized by tools such as ipmi-sel(8). sensor-read Provides an API for reading a sensor. Utilized by tools such as ipmi-sensors(8). spec Provides macros and arrays for various other definitions and tables in IPMI. Utilized by tools such as ipmi-sensors(8). util Provides various utility functions for the calculation of keys, sensor readings, etc. Utilized by most of the rest of FreeIPMI. FILES
/usr/include/freeipmi.h /usr/include/freeipmi/ COPYRIGHT
Copyright (C) 2003-2012 FreeIPMI Core Team. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. SEE ALSO
libipmiconsole(3), libipmidetect(3), libipmimonitoring(3), freeipmi(7), bmc-config(8), bmc-info(8), bmc-watchdog(8), ipmi-chassis(8), ipmi- fru(8), ipmi-locate(8), ipmi-oem(8), ipmi-raw(8), ipmi-sel(8), ipmi-sensors(8), ipmi-sensors-config(8), ipmiconsole(8), ipmidetect(8), ipmiping(8), ipmipower(8), ipmi-pef-config(8), rmcpping(8) http://www.gnu.org/software/freeipmi/ libfreeipmi 1.1.5 @ISODATE LIBFREEIPMI(3)
All times are GMT -4. The time now is 01:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy