08-28-2010
count number of rows based on other column values
Could anybody help with this?
I have input below .....
david,39
david,39
emelie,40
clarissa,22
bob,42
bob,42
tim,32
bob,39
david,38
emelie,47
what i want to do is count how many names there are with different ages, so output would be like this ....
david,2
emelie,2
clarissa,1
bob,2
tim,1
so there are three david's, but two of them are the same age so i would want it to come up with ...
david,male,2
If anybody could point me in the right direction it would be much appreciated
Cheers
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I'm trying to assign a score to each row which will allow me to identify which rows differ. In the example file below, I've used "," to indicate column separators (my actual file has tab separators). In this example, I'd like to identify that row 1 and row 5 are the same, and row 2 and row... (4 Replies)
Discussion started by: auburn
4 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I have the following input which i want to process using AWK.
Rows,NC,amount
1,1202,0.192387
2,1201,0.111111
3,1201,0.123456
i want the following output
count of rows = 3 ,sum of amount = 0.426954
Many thanks (2 Replies)
Discussion started by: pistachio
2 Replies
3. Shell Programming and Scripting
Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count
The input file:
21 2341 A
21 2341 A
21 2341 A
21 2341 C
21 2341 C
21 2341 C
21 2341 C
21 4567 A
21 4567 A
21 4567 C
... (6 Replies)
Discussion started by: juelillo
6 Replies
4. UNIX for Dummies Questions & Answers
I have a text file where the second column is a list of numbers going from small to large. I want to extract the rows where the second column is smaller than or equal to 0.0001.
My input:
rs10082730 9e-08 12 46002702
rs2544081 1e-07 12 46015487
rs1425136 1e-06 7 35396742
rs2712590... (1 Reply)
Discussion started by: evelibertine
1 Replies
5. Shell Programming and Scripting
Hi,
Please help me to convert the input file to a new one.
input file:
--------
1231231231 3 A
4561223343 0 D
1231231231 1 A
1231231231 2 A
1231231231 4 D
7654343444 2 A
4561223343 1 D
4561223343 2 D
the output should be:
--------------------
1231231231 3#1#2 A
4561223343 0 D... (3 Replies)
Discussion started by: vsachan
3 Replies
6. UNIX for Dummies Questions & Answers
I have a space delimited text file. I want to extract rows where the third column has 0 as a value and write those rows into a new space delimited text file. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies
7. UNIX for Dummies Questions & Answers
Hi !
input:
A|B|C|D
A|F|C|E
A|B|I|C
A|T|I|B
As the title of the thread says, I would need to get:
1|3|2|4
I tried different variants of this command, but I don't manage to obtain what I need:
gawk 'BEGIN{FS=OFS="|"}{for(i=1; i<=NF; i++) a++} END {for (b in a) print b}' input
... (2 Replies)
Discussion started by: beca123456
2 Replies
8. Shell Programming and Scripting
I have a .csv file:
A,B,0.6
C,D,-0.7
D,E,0.1
A,E,0.45
D,G, -0.4
I want to select rows based on the values of the 3rd columns such that it is >=0.5 or <= -0.5
Thanks.
A,B,0.6
D,G, -0.7 (1 Reply)
Discussion started by: Sanchari
1 Replies
9. Shell Programming and Scripting
Hi All,
I am trying to select the rows in a fixed width file based on values in the columns.
I want to select only the rows if column position 3-4 has the value AB
I am using cut command to get the column values. Is it possible to check if cut -c3-4 = AB is true then select only that... (2 Replies)
Discussion started by: ashok.k
2 Replies
10. 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
YAGI(1) General Commands Manual YAGI(1)
NAME
yagi - Yagi-Uda project antenna current calculator
SYNOPSIS
yagi [ - dhps ] filename
DESCRIPTION
The program yagi is one of a number of executable programs that forms part of a set of programs, collectively known as the Yagi-Uda project
, which were designed for analysis and optimisation of Yagi-Uda antennas. yagi calculates the currents at the centre of each element at
one or more frequencies, as specified in the input file.
AVAILABILITY
OPTIONS
-d Display element currents. When this option is used, a bar graph with up to 70 stars (*) is used to display the absolute magnitude of
the element currents. The element with the greatest element current has 70 *'s, all others have a corresponding smaller number,
depending on the their relative current. The element current, normallised to the maximum, is also shown as a 4 digit floating point
number.
-h Print a help message.
-p Print the Z matrix. The Z matrix is the impedance matrix, showing the self impedance of the elements on the diagonal and the mutual
impedance off the diagonal.
-s Suppress all diagnostic output. By default, the program print the percentage of the job completed.
filename
is the name of the file containing the antenna description. It is expected to be in a format created by either input or first - two
other programs in the Yagi-Uda project. This is an ASCII text file. The antenna currents are written to a file filename.out which
is a binary file. It is not intended to be read by humans.
Limitations
I'm not aware of any limitations, apart from that filenames, including full path, can't exceed 90 characters.
FILES
filename.out Binary data file
SEE ALSO
first(1), input(1), output(1), optimise(1), first(5), input(5), output(5) and optimise(5).
PLATFORMS
Both DOS and Unix versions have been built. The DOS version as distributed requires a 386 PC with a 387 maths coprocessor.
BUGS
Bugs should be reported to david.kirkby@onetel.net. Bugs tend actually to be fixed if they can be isolated, so it is in your interest to
report them in such a way that they can be easily reproduced. If the input file is edited manually and done incorrectly, there can be
unpredictable results.
AUTHORS
Dr. David Kirkby G8WRB (david.kirkby@onetel.net), with help with converting to DOS from Dr. Joe Mack NA3T (mack@fcrfv2.ncifcrf.gov).
Version 1.16 24th October 2000 YAGI(1)