Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Count the lines with the same values in a column and write the output to a file Post 302665875 by @man on Tuesday 3rd of July 2012 09:51:29 AM
Old 07-03-2012
Count the lines with the same values in a column and write the output to a file

Hey everyone!

I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column.

my input file is like this:
Code:
ID1   1   10M   AAATTTCCGG
ID2   5    4M    ACGT
ID3   5    8M    ACCTTGGA
ID4   5    8M    ACCTTGGA
ID5   5    8M    ACCTTGGA
ID6   20   3M   TCG
ID7   20   3M   TCG
ID8   20   12M   AACCTTGGCCTT
ID9   20   12M   AACCTTGGCCTT
ID10   20   12M   AACCTTGGCCTT

I want my output to be like this:
Code:
1    10M    1    AAATTTCCGG
5    4M     1    ACGT
5    8M     3    ACCTTGGA
20   3M    2    TCG
20   12M   3   AACCTTGGCCTT

Thanks in advance! Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: itsme999
3 Replies

2. Shell Programming and Scripting

Help with script to read lines from file and count values

Hi, I need some help with a script I'm trying to write. I have a log file containing references to a number of different webservices. I wish to write a script that will list the webservices with a count as to how many times they appear in the log. An example of the log file content: ... (2 Replies)
Discussion started by: gman2010
2 Replies

3. UNIX for Dummies Questions & Answers

Count Number Of lines in text files and append values to beginning of file

Hello, I have 50 text files in a directory called "AllFiles" I want to make a program that will go inside of the "AllFiles" Directory and count the number of lines in each individual text file. Then, the program will calculate how many more lines there are over 400 in each text file and... (7 Replies)
Discussion started by: motoxeryz125
7 Replies

4. Shell Programming and Scripting

How to compare the values of a column in awk in a same file and consecutive lines..

I would like to compare the values of 2nd column of consecutive lines of same file in such a way so that if the difference between first value and second value is more than 100 it should print complete line else ignore line. Input File ========== PDB 2500 RTDB 123 RTDB-EAGLE 122 VSCCP 2565... (4 Replies)
Discussion started by: manuswami
4 Replies

5. Shell Programming and Scripting

Word count of values in a column

Hi friends, I have an input file of the following format a b c 1.11112 d e f 4.5767 g h i 19.098 k i l 87.9999 I am looking for an awk one liners that would help me in giving the following output output.txt Range of the column: 1.11112 to 87.9999 Total records between 1 and 10 - 2... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

6. UNIX for Dummies Questions & Answers

count number of distinct values in each column with awk

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

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

8. Shell Programming and Scripting

Count frequency of unique values in specific column

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

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

10. UNIX for Beginners Questions & Answers

Copy columns from one file into another and get sum of column values and row count

I have a file abc.csv, from which I need column 24(PurchaseOrder_TotalCost) to get the sum_of_amounts with date and row count into another file say output.csv abc.csv- UTF-8,,,,,,,,,,,,,,,,,,,,,,,,, ... (6 Replies)
Discussion started by: Tahir_M
6 Replies
Tspi_DAA_VerifyInit(3)					     Library Functions Manual					    Tspi_DAA_VerifyInit(3)

						     TCG Software Stack Developer's Reference

NAME
Tspi_DAA_VerifyInit - creates a challenge for the TCG platform SYNOPSIS
#include <tss/tss_typedef.h> #include <tss/tss_structs.h> #include <tss/tspi.h> TSPICALL Tspi_DAA_VerifyInit( TSS_HDAA hDAA, UINT32* nonceVerifierLength, BYTE** nonceVerifier, UINT32* baseNameLength, BYTE** baseName ); DESCRIPTION
Tspi_DAA_VerifyInit is part of the DAA Verifier component. It's the first function out of 2 in order to verify a DAA Credential of a TCG platform. It creates a challenge for the TCG platform. This is an optional function and does not require a TPM or a TCS. PARAMETERS
hDAA The hDAA parameter is used to specify the handle of the DAA object. nonceVerifierLength The nonceVerifierLength parameter is the length of the nonceVerifier. nonceVerifier The nonceVerifier parameter is the challenge for the platform. baseNameLength The baseNameLength parameter is the length of the baseName. baseName The baseName parameter is the base name that was chosen for the DAA Signature. RETURN CODES
Tspi_DAA_VerifyInit returns TSS_SUCCESS on success, otherwise one of the following values is returned: TSS_E_BAD_PARAMETER TSS_E_INTERNAL_ERROR An internal SW error has been detected. CONFORMING TO Tspi_DAA_VerifyInit conforms to the Trusted Computing Group Software Specification version 1.2 SEE ALSO
Tspi_DAA_IssuerKeyVerification(3) TSS 1.2 2006-09-04 Tspi_DAA_VerifyInit(3)
All times are GMT -4. The time now is 07:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy