Sponsored Content
Top Forums Shell Programming and Scripting Help with Getting distinct record count from a .dat file using UNIX command Post 302974990 by MS06 on Tuesday 7th of June 2016 01:30:32 AM
Old 06-07-2016
Help with Getting distinct record count from a .dat file using UNIX command

Hi,
I have a .dat file with contents like the below:

Input file

Code:
 ============SEQ NO-1: COLUMN1==========
 9835619
 7152815
============SEQ NO-2: COLUMN2 ==========
  7615348
 7015548
  9373086
============SEQ NO-3: COLUMN3===========
 9373086


Expected Output: (I just need the total distinct count of records under a separate header-as like below)
Code:
 ============SEQ NO-1: COLUMN1==========
2
============SEQ NO-2: COLUMN2 ==========
 3
 ============SEQ NO-3: COLUMN3===========
1

Please help me with the unix command for the same.

Last edited by Don Cragun; 06-07-2016 at 05:04 AM.. Reason: Add CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to count the record count in an EBCDIC file.

How do I get the record count in an EBCDIC file on a Linux Box. :confused: (1 Reply)
Discussion started by: oracle8
1 Replies

2. UNIX for Dummies Questions & Answers

Record count problem using sed command

Hi, I have a script which removes 2 header records and 1 trailer record in a list of files. The commands doing the actions are sed '1,2d' $file > tempfile1.dat sed '$d' < tempfile1.dat > $output.txt Its working fine for all records except a file having size=1445509814 and number of... (2 Replies)
Discussion started by: ayanbiswas
2 Replies

3. Shell Programming and Scripting

Getting Sum, Count and Distinct Count of a file

Hi all this is a UNIX question. I have a large flat file with millions of records. col1|col2|col3 1|a|b 2|c|d 3|e|f 3|g|h footer**** I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3 I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies

4. UNIX for Dummies Questions & Answers

Record count in Unix servers

Hi All, when i ftp the file from windows machine to unix server the record count in the file is decreased by 1. example: Say a text file has three lines in it and when you place this file in unix server from your local machine and run a below command cat filename | wc -l the output is... (2 Replies)
Discussion started by: Umeshrm
2 Replies

5. UNIX for Dummies Questions & Answers

Count rows in .dat file

Could you please tell e how to find the total number of rows in a .dat file. edit by bakunin: this is exactly why in "advanced and expert" section?? I transfer this thread to "Unix for Dummies Questions and Answers" (2 Replies)
Discussion started by: Deeptanshu
2 Replies

6. Shell Programming and Scripting

FASTEN count line of dat file and compare with the CTRL file

Hi All, I thinking on how to accelerate the speed on calculate the dat file against the number of records CTRL file. There are about 300 to 400 folder directories that contains both DAT and CTL files. DAT contain all the flat files records CTL is the reference check file for the... (3 Replies)
Discussion started by: ckwan
3 Replies

7. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

8. Shell Programming and Scripting

Finding total distinct count from multiple csv files through UNIX script

Hi All , I have multiple pipe delimited csv files are present in a directory.I need to find out distinct count on a column on those files and need the total distinct count on all files. We can't merge all the files here as file size are huge in millions.I have tried in below way for each... (9 Replies)
Discussion started by: STCET22
9 Replies

9. UNIX for Beginners Questions & Answers

awk command to retrieve record 23 and 89 from UNIX file

Hi Everyone, I am looking for awk command to retrieve only the record number 23 and record number 89 from a unix file? Please let me know what is the awk command for this? Regards Rakesh (1 Reply)
Discussion started by: rakeshp
1 Replies

10. Homework & Coursework Questions

awk command to retrieve record 23 and 89 from UNIX file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am looking for awk command to retrieve only the record number 23 and record number 89 from a unix file?... (6 Replies)
Discussion started by: rakeshp
6 Replies
g_principal(1)					 GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c				    g_principal(1)

NAME
g_principal - calculates axes of inertia for a group of atoms VERSION 4.5.4-dev-20110404-bc5695c SYNOPSIS
g_principal -f traj.xtc -s topol.tpr -n index.ndx -a1 axis1.dat -a2 axis2.dat -a3 axis3.dat -om moi.dat -[no]h -[no]version -nice int -b time -e time -dt time -tu enum -[no]w -[no]foo DESCRIPTION
g_principal calculates the three principal axes of inertia for a group of atoms. FILES
-f traj.xtc Input Trajectory: xtc trr trj gro g96 pdb cpt -s topol.tpr Input Structure+mass(db): tpr tpb tpa gro g96 pdb -n index.ndx Input, Opt. Index file -a1 axis1.dat Output Generic data file -a2 axis2.dat Output Generic data file -a3 axis3.dat Output Generic data file -om moi.dat Output Generic data file OTHER OPTIONS
-[no]hno Print help info and quit -[no]versionno Print version info and quit -nice int 19 Set the nicelevel -b time 0 First frame (ps) to read from trajectory -e time 0 Last frame (ps) to read from trajectory -dt time 0 Only use frame when t MOD dt = first time (ps) -tu enum ps Time unit: fs, ps, ns, us, ms or s -[no]wno View output .xvg, .xpm, .eps and .pdb files -[no]foono Dummy option to avoid empty array SEE ALSO
gromacs(7) More information about GROMACS is available at <http://www.gromacs.org/>. Mon 4 Apr 2011 g_principal(1)
All times are GMT -4. The time now is 04:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy