08-02-2016
If the index constructed from $1 and $2 does not exist in the temp array T, its a new combination, and the counter for $1 is incremented. When the input file ends, all these counters and the corresponding $1 values are printed.
More detailed:
For the first occurrence of the $1,$2 combination, T[$1,$2] doesn't exist, so !T[$1,$2] is true, and the counter C[$1] is incremented. Due to the increment of T , the next time the combination is encountered, nothing will happen. C[$1] thus counts up the different $2s for every single $1. In the end, the count for every single $1 is printed.
Last edited by RudiC; 08-02-2016 at 03:41 PM..
This User Gave Thanks to RudiC For This Post:
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies
2. Shell Programming and Scripting
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
Hi, I have tab-deliminated data similar to the following:
dot is-big 2
dot is-round 3
dot is-gray 4
cat is-big 3
hot in-summer 5
I want to count the frequency of each individual "unique" value in the 1st column. Thus, the desired output would be as follows:
dot 3
cat 1
hot 1
is... (5 Replies)
Discussion started by: owwow14
5 Replies
4. UNIX for Dummies Questions & Answers
Hello, I'm trying to used awk but am new to this. I have a file like this:
Bob is a good boy
Bob is a strange person
Bob is a good dancer
Jane can party
Jane is a good girl
Jane is batty
I'd like to get this:
Bob is a good boy
is a strange person
is a good dancer
Jane... (4 Replies)
Discussion started by: Billyjo
4 Replies
5. Shell Programming and Scripting
I am trying to sort, do uniq by 1st column and report this 4 columns tab delimiter table , eg
chr10:112174128 rs2255141 2E-10 Cholesterol, total
chr10:112174128 rs2255141 7E-16 LDL
chr10:17218291 rs10904908 3E-11 HDL Cholesterol
chr10:17218291 rs970548 8E-9 TG... (4 Replies)
Discussion started by: fat
4 Replies
6. UNIX for Dummies Questions & Answers
Background:
I have a file of thousands of potential SSR primers from Batch Primer 3.
I can't use primers that will contain the same sequence ID or sequence as another primer.
I have some basic shell scripting skills, but not enough to handle this.
What you need to know:
I need to remove the... (1 Reply)
Discussion started by: msatseqs
1 Replies
7. UNIX for Beginners Questions & Answers
Hi All,
Does anyone have any suggestions/examples of how i could show only lines where the first field is not duplicated. If the first field is listed more than once it shouldnt be shown even if the other columns make it unique.
Example file :
876,RIBDA,EC2
876,RIBDH,EX7
877,RIBDF,E28... (4 Replies)
Discussion started by: mutley2202
4 Replies
8. UNIX for Beginners Questions & Answers
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
9. Shell Programming and Scripting
What is an efficient way of counting the number of unique values in a 400 column by 1000 row array and outputting the counts per column, assuming the unique values in the array are:
A, B, C, D
In other words the output should look like: Value COL1 COL2 COL3
A 50 51 52... (16 Replies)
Discussion started by: Geneanalyst
16 Replies
LEARN ABOUT DEBIAN
rlm_counter
rlm_counter(5) FreeRADIUS Module rlm_counter(5)
NAME
rlm_counter - FreeRADIUS Module
DESCRIPTION
The rlm_counter module provides a general framework to allow access based on accumulated usage of a resource, such as total time online in
a given period, total data transferred in a given period, etc. This is very useful in a 'Prepaid Service' situation, where a user has paid
for a finite amount of usage and should not be allowed to use more than that service. Collection, monitoring, and replenishment of prepaid
services are beyond the scope of this module.
The main configuration items to be aware of are:
filename
The filename where the usage data is stored.
key An attribute which will be present in the Access-Request to be used as the 'index' value for the counter. A counter entry is tracked
for each unique key. The most likely key you will want to use is User-Name.
count-attribute
An attribute which will be used to increment the counter value. If this attribute is Acct-Session-Time or an integer value the
counter data is incremented by the Attribute value. For all other attribute types the counter is incremented by one.
reset How frequently the counter data should be set back to 0. Valid values for this variable are: hourly, daily, weekly, monthly, orn-
ever Alternatively, it can be user defined, in the form: num[hdwm]. num is a numeric value, followed by one or none of the follow-
ing letters. h: hours, d: days, w: weeks, m: months.
check-name
This defines an attribute name which will be registered by the counter module and can be used to set the maximum allowed value for
the counter after which the user is rejected. If Daily-Session-Time is set, you can use the following syntax in the Users file to
set a cap of 3600 seconds ( 8 hours ):
DEFAULT Max-Daily-Session := 3600
reply-name
This is the name of the attribute which will contain the remaining value for the counter in the reply packet when the user is suc-
cessfully authorized. The default attribute name is "Session-Timeout".
allowed-servicetype
This can be used to only apply the limitations to specific service types of sessions. For example, setting this to Framed-User will
only apply the counter module to Framed sessions, excluding other types such as Telnet or Rlogin.
cache-size
The maximum size of the cache to be used by the module. The default is 1000.
NOTES
This module registers an attribute, so it should be added to the instantiate section, to be called on server startup. When used in the
authorize section, it must come after any modules which set the 'check-name' attribute.
SECTIONS
instantiate, authorize, accounting
FILES
/etc/raddb/radiusd.conf
SEE ALSO
radiusd(8), radiusd.conf(5) rlm_sqlcounter(5)
AUTHOR
Chris Parker, cparker@segv.org
13 March 2004 rlm_counter(5)