Sponsored Content
Top Forums Shell Programming and Scripting Trying to find the Count of Other Column Post 302999003 by Don Cragun on Monday 12th of June 2017 04:58:31 AM
Old 06-12-2017
Maybe you want something more like:
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])
}' temp10.csv

which with your sample input produces the output:
Code:
                   Oilv name  Total Count  ACKED  NOT_ACKED
                        AWX3            3      0          3
               EnvironmentsX            5      2          3
Bad ASG distribution in Prod            2      0          2

This User Gave Thanks to Don Cragun 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
PAPS(1) 						      General Commands Manual							   PAPS(1)

NAME
paps - UTF-8 to PostScript converter using Pango SYNOPSIS
paps [options] files... DESCRIPTION
paps reads a UTF-8 encoded file and generates a PostScript language rendering of the file. The rendering is done by creating outline curves through the pango ft2 backend. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. --landscape Landscape output. Default is portrait. --columns=cl Number of columns output. Default is 1. --font=desc Set the font description. Default is Monospace 12. --rtl Do rtl layout. --paper ps Choose paper size. Known paper sizes are legal, letter, a4. Default is A4. --bottom-margin=bm Set bottom margin in postscript points (1/72 inch). Default is 36. --top-margin=tm Set top margin. Default is 36. --left-margin=lm Set left margin. Default is 36. --right-margin=rm Set right margin. Default is 36. --help Show summary of options. --header Draw page header for each page. --markup Interpret the text as pango markup. --encoding=ENCODING Assume the documentation encoding is ENCODING. --lpi Set the lines per inch. This determines the line spacing. --cpi Set the characters per inch. This is an alternative method of specifying the font size. --stretch-chars Indicates that characters should be stretched in the y-direction to fill up their vertical space. This is similar to the texttops behaviour. AUTHOR
paps was written by Dov Grobgeld <dov.grobgeld@gmail.com>. This manual page was written by Lior Kaplan <kaplan@debian.org>, for the Debian project (but may be used by others). April 17, 2006 PAPS(1)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy