Sponsored Content
Top Forums Shell Programming and Scripting awk count how many unique IPs have received that error Post 302633697 by arrals_vl on Wednesday 2nd of May 2012 10:36:06 AM
Old 05-02-2012
awk count how many unique IPs have received that error

Hi all,

I want to write a awk script that counts unique IPs that have received one special error.
For example

Code:
25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS
25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23
30-04-2012;192.168.70.33;e;null;null;Failure
30-04-2012;192.168.70.33;e;null;null;Failure
30-04-2012;192.168.70.33;e;null;null;Failure
30-04-2012;192.168.70.33;e;null;null;Failure
30-04-2012;192.168.70.33;e;null;null;Failure
30-04-201;192.168.70.34;e;null;null;ERROR_22
30-04-2012;192.168.70.37;e;null;null;Failure.
30-04-2012;192.168.70.10;e;null;null;Failure

The result should be:

Code:
Error name              Number of unique IPs

General_ERROR_23 =     1
Failure  = 3
ERROR_22  =  1

etc...

Moderator's Comments:
Mod Comment Code tags for code, please.


Thank you very much!

Ervin

Last edited by Corona688; 05-02-2012 at 12:12 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk count how many IP have received that error

Hi all, I want to write a awk script that counts unique IPs that have received one special error. For example 25-04-2012;192.168.70.31;1254545454545417;500.0;SUCCESS 25-04-2012;192.168.70.32;355666650914;315126423993;;General_ERROR_23 30-04-2012;192.168.70.33;e;null;null;Failure... (4 Replies)
Discussion started by: arrals_vl
4 Replies

2. Shell Programming and Scripting

awk pattern match and count unique in column

Hi all I have a need of searching some pattern in file by month and then count unique records D11 G11 R11 -------> Pattern available in file S11 Jan$1 to $5 column contains some records in which I want to find unique for this purpose I have written script like below awk '/Jan/ ||... (4 Replies)
Discussion started by: nex_asp
4 Replies

3. Shell Programming and Scripting

awk to count using each unique value

Im looking for an awk script that will take the unique values in column 5, then print and count the unique values in column 6. CA001011500 11111 11111 -9999 201301 AAA CA001012040 11111 11111 -9999 201301 AAA CA001012573 11111 11111 -9999 201301 BBB CA001012710 11111 11111 -9999 201301... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

4. UNIX for Dummies Questions & Answers

How to count no. of received data of any one files?

Hi Guys, I have a file where is different task_id and every task id has many received data, now we have to count no. of received data for any task_id. (received means received words, i.e. count no. of received word of any task_id) Please help us Guys. (5 Replies)
Discussion started by: aaditya321
5 Replies

5. Shell Programming and Scripting

awk unique count of partial match with semi-colon

Trying to get the unique count of the below input, but if the text in beginning of $5 is a partial match to another line in the file then it is not unique. awk awk '!seen++ {n++} END {print n}' input 7 input chr1 159174749 159174770 chr1:159174749-159174770 ACKR1 chr1 ... (2 Replies)
Discussion started by: cmccabe
2 Replies

6. Shell Programming and Scripting

Count occurrence of column one unique value having unique second column value

Hello Team, I need your help on the following: My input file a.txt is as below: 3330690|373846|108471 3330690|373846|108471 0640829|459725|100001 0640829|459725|100001 3330690|373847|108471 Here row 1 and row 2 of column 1 are identical but corresponding column 2 value are... (4 Replies)
Discussion started by: angshuman
4 Replies

7. UNIX for Beginners Questions & Answers

Awk: count unique element of array

Hi, tab-separated input: blabla_1 A,B,C,C blabla_2 A,E,G blabla_3 R,Q,A,B,C,R,Q output: blabla_1 3 blabla_2 3 blabla_3 5 After splitting $2 in an array, I am trying to store the number of unique elements in a variable, but have some difficulties resetting the variable to 0 before... (6 Replies)
Discussion started by: beca123456
6 Replies

8. UNIX for Beginners Questions & Answers

Count unique words

Dear all, I would like to know how to list and count unique words in thousands number of text files. Please help me out thanks in advance (9 Replies)
Discussion started by: imranrasheedamu
9 Replies

9. UNIX for Beginners Questions & Answers

Count unique column

Hello, I am trying to count unique rows in my file based on 4 columns (2-5) and to output its frequency in a sixth column. My file is tab delimited My input file looks like this: Colum1 Colum2 Colum3 Colum4 Coulmn5 1.1 100 100 a b 1.1 100 100 a c 1.2 200 205 a d 1.3 300 301 a y 1.3 300... (6 Replies)
Discussion started by: nans
6 Replies

10. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
COROSYNC-NOTIFYD(8)					      System Manager's Manual					       COROSYNC-NOTIFYD(8)

NAME
corosync-notifyd - Listen for important corosync events and send dbus and/or snmp traps. SYNOPSIS
corosync-notifyd [-f] [-l] [-o] [-s] [-m] [manager] [-d] [-h] DESCRIPTION
corosync-notifyd uses corosync API to listen for important cluster events and can log them, generate dbus signals or genterate snmp traps. OPTIONS
-f Start application in foreground. -l Log all events. -o Print events to stdout (turns on -l). -s Send SNMP traps on all events. -m Set the SNMP manager address. -d Send DBUS signals on all events. -h Print this help EXAMPLES
$ corosync-notifyd -o corosync-notifyd[18505]: troll[23374016] corosync-notify:18505:12 is now connected to corosync corosync-notifyd[18505]: troll[23374016] corosync-notify:18505:13 is now disconnected from corosync corosync-notifyd[18505]: troll[23374016] is now quorate corosync-notifyd[18505]: r2[1550100672] ip:192.168.100.92 joined corosync-notifyd[18505]: r2[1550100672] ip:192.168.100.92 left $ corosync-notifyd -o Note this output below is from "dbus-monitor --system" signal sender=:1.216 -> dest=(null destination) serial=2 path=/com/redhat/cluster/corosync; interface=com.redhat.cluster.corosync; member=ConnectionStateChange string "troll" uint32 23374016 string "corosync-notify:18900:12" string "connected" signal sender=:1.216 -> dest=(null destination) serial=3 path=/com/redhat/cluster/corosync; interface=com.redhat.cluster.corosync; member=ConnectionStateChange string "troll" uint32 23374016 string "corosync-notify:18900:13" string "disconnected" signal sender=:1.216 -> dest=(null destination) serial=4 path=/com/redhat/cluster/corosync; interface=com.redhat.cluster.corosync; member=QorumStateChange string "troll" uint32 23374016 string "quorate" signal sender=:1.216 -> dest=(null destination) serial=5 path=/com/redhat/cluster/corosync; interface=com.redhat.cluster.corosync; member=NodeStateChange string "r2" uint32 1550100672 string "192.168.100.92" string "joined" signal sender=:1.216 -> dest=(null destination) serial=6 path=/com/redhat/cluster/corosync; interface=com.redhat.cluster.corosync; member=NodeStateChange string "r2" uint32 1550100672 string "192.168.100.92" string "left" SEE ALSO
corosync(8), corosync-cmapctl(8), dbus-monitor(1), AUTHOR
Angus Salkeld 2011-01-14 COROSYNC-NOTIFYD(8)
All times are GMT -4. The time now is 10:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy