Sponsored Content
Top Forums Shell Programming and Scripting Count frequency of unique values in specific column Post 302885598 by RavinderSingh13 on Monday 27th of January 2014 12:45:00 PM
Old 01-27-2014
Hello,

Here is the solution for same.

Code:
awk '{a[$1]++;} END{for(i in a) print a[i]"  "i}' file_name

Output will be as follows.

Code:
1  hot
3  dot
1  cat



Thanks,
R. Singh
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print unique values of a column and sum up the corresponding values in next column

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

How to count Unique Values from a file.

Hi I have the following info in a file - <Cell id="25D"/> <Cell id="26A"/> <Cell id="26B"/> <Cell id="26C"/> <Cell id="27A"/> <Cell id="27B"/> <Cell id="27C"/> <Cell id="28A"/> I would like to know how would you go about counting all... (4 Replies)
Discussion started by: Prega
4 Replies

3. UNIX for Dummies Questions & Answers

How to count specific columns and merge with unique ones?

Hi. I am not sure the title gives an optimal description of what I want to do. I have several text files that contain data in many columns. All the files are organized the same way, but the data in the columns might differ. I want to count the number of times data occur in specific columns,... (0 Replies)
Discussion started by: JamesT
0 Replies

4. Shell Programming and Scripting

Count specific column values

Hi all: quick question! I have the following data that resembles some thing like this: i am tired tired am i what is up hello people cool I want to count (or at least isolate) all of the unique elements in the 2nd column. I have tried this: cut -f 2 | uniq 'input' which does... (3 Replies)
Discussion started by: owwow14
3 Replies

5. Shell Programming and Scripting

Count Unique values from multiple lists of files

Looking for a little help here. I have 1000's of text files within a multiple folders. YYYY/ /MM /1000's Files Eg. 2014/01/1000 files 2014/02/1237 files 2014/03/1400 files There are folders for each year and each month, and within each monthly folder there are... (4 Replies)
Discussion started by: whegra
4 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. Shell Programming and Scripting

Print count of unique values

Hello experts, I am converting a number into its binary output as : read n echo "obase=2;$n" | bc I wish to count the maximum continuous occurrences of the digit 1. Example : 1. The binary equivalent of 5 = 101. Hence the output must be 1. 2. The binary... (3 Replies)
Discussion started by: H squared
3 Replies

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

9. Shell Programming and Scripting

Count number of unique values in each column of array

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
GVPACK(1)						      General Commands Manual							 GVPACK(1)

NAME
gvpack - merge and pack disjoint graphs SYNOPSIS
gvpack [ -nguv? ] [ -mmargin ] [ -ooutfile ] [ -Gname=value ] [ files ] DESCRIPTION
gvpack reads in a stream of graphs, combines the graphs into a single layout, and produces a single graph serving as the union of the input graphs. The input graphs must be in dot format, and must have all necessary layout information. Acceptable input is produced by applying a Graphviz layout program, such as dot or neato, with no -T flag. By default, the packing is done at the cluster level. Thus, parts of one graph will not intrude into any top-level clusters or overlap any nodes or edges of another. The output of gvpack can be used to produce concrete output by applying neato -s -n2 with the desired -T flag. OPTIONS
The following options are supported: -g Combines the graphs at the graph level. This uses more space, but prevents parts of one graph from occurring between parts of another. -Gname=value Specifies attributes to be added to the resulting union graph. For example, this can be used to specify a graph label. -mmargin Packs the graphs allowing a margin of output points around the parts. -n Combines the graphs at the node level. Clusters are ignored in the packing. -ooutput Prints output to the file output. If not given, gvpack uses stdout. -u Don't pack the graphs. Just combine them into a single graph. -v Verbose mode. -? Prints usage information and exit. OPERANDS
The following operand is supported: files Names of files containing 1 or more graphs in dot format. If no files operand is specified, the standard input will be used. RETURN CODES
gvpack returns 0 if there were no problems, and non-zero otherwise. EXAMPLES
ccomps -x abc.dot | dot | gvpack | neato -s -n2 -Tps This pipeline decomposes the graph in abc.dot into its connected components, lays out each using dot, packs them all together again, and produces the final drawing in PostScript. Of course, there is nothing to prevent one from using different layouts for each component. BUGS
All the input graphs must be directed or undirected. An input graph should not have a label, since this will be used in its layout. Since gvpack ignores root graph labels, resulting layout may contain some extra space. gvpack unsets the bounding box attribute of all non-cluster subgraphs. AUTHORS
Emden R. Gansner <erg@research.att.com> SEE ALSO
gvpr(1), dot(1), neato(1), twopi(1), ccomps(1), libpack(3) 8 April 2003 GVPACK(1)
All times are GMT -4. The time now is 03:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy