Sponsored Content
Top Forums Shell Programming and Scripting Trying to find the Count of Other Column Post 303001356 by RudiC on Wednesday 2nd of August 2017 07:43:35 AM
Old 08-02-2017
No idea by yourself on how to go about it?

Building on what Don Cragun posted, try
Code:
awk -F, '
BEGIN   {m = 9
        }
$9 ~ /^(High|Critical)$/ &&
$7 == "availability"            {c[$6]++
                                 n[$6] += $11 == "NO"
                                 y[$6] += $11 == "YES"
                                 if(length($6) > m) m = length($6)
                                }
END                             {printf("%*s  Total Count  ACKED  NOT_ACKED\n", m, "Oilv name")
                                 for(i in c)    {printf("%*s  %11d  %5d  %9d\n", m, i, c[i], y[i], n[i])
                                                 CT += c[i]
                                                 NT += n[i]
                                                 YT += y[i]
                                                }
                                 printf ("%*s  %11d  %5d  %9d\n", m, "Total", CT, YT, NT)

                                }
'  temp10.csv
                   Oilv name  Total Count  ACKED  NOT_ACKED
Bad ASG distribution in Prod            2      0          2
                        AWX3            3      0          3
               EnvironmentsX            5      2          3
                       Total           10      2          8

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find expression with awk in only one column, and if it fits, print whole column

Hi. How do I find an expression with awk in only one column, and if it fits, then print that whole column. 1 apple oranges 2 bannanas pears 3 cats dogs 4 hesaid shesaid echo "which number:" read NUMBER (user inputs number 2 for this example) awk " /$NUMBER/ {field to search is field... (2 Replies)
Discussion started by: glev2005
2 Replies

2. UNIX for Advanced & Expert Users

column count

I am making a script in bash shell and need to find out how many columns are in each row. I tried using awk '{print NF}' which will give me the number of columns for each row of the file all at once which is not what i want. I am trying to read each line individual from a file and want to know... (6 Replies)
Discussion started by: HackerSeabass
6 Replies

3. Shell Programming and Scripting

Column value and it's count

Hi, i have data like a b a a b c d ... I have to output info of each distinct value that appears in the column and the count of it a-3,b-2,c-1,d-1 Is there a single line command using awk or sed to accomplish this? Thanks, -srinivas yelamanchili (7 Replies)
Discussion started by: ysrini
7 Replies

4. Shell Programming and Scripting

Need Count of Column

Need help on count AL06 AL06_71 A=1 it=1 90 AL06 AL06_72 A=1 it=1 60 AL06 AL06_73 A=1 it=1 80 AL06 AL06_7 A=2 it=1 0 AL06 AL06_7 A=2 it=1 0 AL06 AL06_7 A=2 it=1 0 AL07 AL07_71 A=1 it=1 40 AL07 AL07_72 A=1 it=1 40 AL07 AL07_73 A=1 it=1 70 AL08 AL08_7 A=2 it=1 0 1 AL08 AL08_7 A=2 it=1... (2 Replies)
Discussion started by: asavaliya
2 Replies

5. Shell Programming and Scripting

Find lines with matching column 1 value, retain only the one with highest value in column 2

I have a file like: I would like to find lines lines with duplicate values in column 1, and retain only one based on two conditions: 1) keep line with highest value in column 3, 2) if column 3 values are equal, retain the line with the highest value in column 4. Desired output: I was able to... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

6. UNIX for Dummies Questions & Answers

Count column

how do i count column in a file. test1,test2,test3,,, = 5 columns (6 Replies)
Discussion started by: lawsongeek
6 Replies

7. 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

8. Shell Programming and Scripting

Column 2 string count in Column 3

My I/p is Col1|Col2|Col3 2116209997932|POSIX INC|POSIX 2116209997933|POSIX INC|POSIX 2116210089479|POSIX INC|POSIX 2116210180502|POSIX INC|POSIX 2116210512279|POSIX INC|Aero 2116210516838|POSIX INC|POSIX 2116210534342|POSIX INC|postal 2116210534345|POSIX INC|postal ... (6 Replies)
Discussion started by: nikhil jain
6 Replies

9. Shell Programming and Scripting

awk to find maximum and minimum from column and store in other column

Need your support for below. Please help to get required output If column 5 is INV then only consider column1 and take out duplicates/identical rows/values from column1 and then put minimum value of column6 in column7 and put maximum value in column 8 and then need to do subtract values of... (7 Replies)
Discussion started by: as7951
7 Replies

10. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
RADLIST(1)							Yard Radius Manual							RADLIST(1)

NAME
radlist - lists current on-line users and per user stats SYNOPSIS
radlist [ -bhnstx ] [ -D|M|Y ] [ -F format_string ] [ -d day ] [ -m month ] [ -y year ] [ -u user ] [ -y year ] DESCRIPTION
This program gives detailed statistics for current users on line (which is the default) or any user you like. Its statistics are on a per- day/month/year base and can be used to produced useful reports. It shows on-line time and traffic, along with numbers of logins and cur- rent port usage. Its output can be largerly customized as you prefer with a suitable format string. See FORMATS section below. OPTIONS
-b Uses a brief output format. -t Uses a `traditional' tabular output format. -n Skips the header when `-t' option is used. -h Prints out usage of the command. -F -Hformat_string Define customized formats for output rows and the header. See FORMATS section below. -m month Reports statistics for month month where month is in the range 1-12. -y year Reports statistics for year year that is a four digits number. -x Shows extedend information (port information). - u user Gets a single username database entry, i.e. select a specific username to report statistics for that user only. -M -D -Y Reports statistics on a dayly/monthly/yearly basis. They should be used along with d,m,y options. If not specified current date and -M is considered. FORMATS
radlist does allow the user to have a customized output format with the `-F' command line option (see above). The program accepts and out- puts any character in a format string and parse it to find some %-prefixed one-letter tokens. Those `a la' printf tokens are substituted with corresponding entry values. Normal C substitution are performed for \, , , and \%. The list of legal % tokens follows, any oher combination is parsed and ignored. Token Value --------------------------------------------------------- %l Username %s Number of current sessions %n Total number of sessions in the period specified %t Total online time in secs %T Total online time in HH:MM:SS format %i Total input traffic in bytes %I Total input traffic in KBytes %o Total output traffic in bytes %O Total output traffic in KBytes %m Total traffic in bytes %M Total traffic in KBytes %k Mean online time per session in secs %K Mean online time per session in HH:MM:SS format %g Mean traffic per session in bytes %G Mean traffic per session in KBytes %% literal '%' No alignment decimal values are allowed in this version of format strings. FILES
/usr/logs/YEAR/user-stats These are files which constitutes the yearly radlist database. They are in binary GDBM format and collect statistics on a per user base, day by day. /usr/logs/NAS/YEAR/detail-XX These text files stores accounting information for every access server (NAS) listed in the clients file. Each user session is iden- tified by a unique session-id and these accounting files store start/stop records for every single authenticated session. Informa- tion stored in those records, but for a group of standard ones, strictly depend on the NAS model and operating system. BUGS
The -x option apparently is not working. SEE ALSO
radiusd(8), radlast(1) builddbm(8), radtest(1), radwatch(1), radius_attributes(5) AUTHOR
Francesco Paolo Lovergine <francesco@yardradius.org>. A complete list of contributors is contained in CREDITS file. You should get that file among other ones within your distribution and pos- sibly installed under /usr/docs directory COPYRIGHT
Copyright (C) 1997 Cristian Gafton. All rights reserved. Copyright (C) 1999-2004 Francesco Paolo Lovergine. All rights reserved. See the LICENSE file enclosed within this software for conditions of use and distribution. This is a pure ISO BSD Open Source License . 1.1 Aug 25, 2004 RADLIST(1)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy