Printing unique numbers from each file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Printing unique numbers from each file
# 1  
Old 05-10-2014
Printing unique numbers from each file

I have some files named file1, file2, fille3......etc. These files are in a folder f1. The content of files are shown below. I would like to count the unique pairs of third column in each file. some files have no data. It should be printed as zero. Your help would be appreciated.

file1

Code:
ARG ASP 155-122 155 122 B-A NH1-OD1 3.47172
ARG ASP 155-122 155 122 B-A NH1-OD2 3.61227
ARG GLU 155-124 155 124 B-A NH2-OE1 2.97287
ARG GLU 155-124 155 124 B-A NH2-OE2 3.92621
ARG ASP 156-29 156 29 B-A NH1-OD1 3.4752
ARG ASP 156-29 156 29 B-A NH1-OD2 3.18324
ARG GLN 156-125 156 125 B-A NH1-OE1 3.12772

file2

Code:
ARG GLN 537-116 537 116 B-A NH2-OE1 3.82477
ARG GLN 537-116 537 116 B-A NH2-OE2 3.82477

Desired output

Code:
file1   4
file2   1


Last edited by samra; 05-10-2014 at 12:20 PM..
# 2  
Old 05-10-2014
Is this a homework assignment?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unique entries based on a range of numbers.

Hi, I have a matrix like this: Algorithm predicted_gene start_point end_point A x 65 85 B x 70 80 C x 75 85 D x 10 20 B y 125 130 C y 120 140 D y 200 210 Here there are four tab-separated columns. The first column is the used algorithm for prediction, and there are 4 of them A-D.... (8 Replies)
Discussion started by: flyfisherman
8 Replies

2. Homework & Coursework Questions

Lex: analyzing a C file and printing out identifiers and line numbers they're found on

Florida State University, Tallahassee, FL USA, Dr. Whalley, COP4342 1. The problem statement, all variables and given/known data: Create a lex specification file that reads a C source program that ignores keywords and collects all identifiers (regular variable names) and also displays the line... (3 Replies)
Discussion started by: D2K
3 Replies

3. Shell Programming and Scripting

unique random numbers awk

Hi, I have a small piece of awk code (see below) that generates random numbers. gawk -F"," 'BEGIN { srand(); for (i = 1; i <= 30; i++) printf("%s AM329_%04d\n",$0,int(36 * rand())+1) }' OFS=, AM329_hole_names.csv The code works fine and generates alphanumeric numbers like AM329_0001,... (2 Replies)
Discussion started by: theflamingmoe
2 Replies

4. Shell Programming and Scripting

Change unique file names into new unique filenames

I have 84 files with the following names splitseqs.1, spliseqs.2 etc. and I want to change the .number to a unique filename. E.g. change splitseqs.1 into splitseqs.7114_1#24 and change spliseqs.2 into splitseqs.7067_2#4 So all the current file names are unique, so are the new file names.... (1 Reply)
Discussion started by: avonm
1 Replies

5. Shell Programming and Scripting

Replace string ids with unique numbers

Hello, I have a file with a 1000 ids in the form of strings. I want to replace each id with a unique numbers in the whole file. each id is repeating in all the columns. I know I can use sed command but there are many ids in file which are need to be converted example of input file B752... (4 Replies)
Discussion started by: ryan9011
4 Replies

6. Shell Programming and Scripting

How to generate 10.000 unique numbers?

hello, does anybody can give me a hint on how to generate a lot of numbers which are not identically via scripting etc? (7 Replies)
Discussion started by: xrays
7 Replies

7. Shell Programming and Scripting

get part of file with unique & non-unique string

I have an archive file that holds a batch of statements. I would like to be able to extract a certain statement based on the unique customer # (ie. 123456). The end for each statement is noted by "ENDSTM". I can find the line number for the beginning of the statement section with sed. ... (5 Replies)
Discussion started by: andrewsc
5 Replies

8. UNIX for Dummies Questions & Answers

Getting unique list of numbers using grep

Hi, I am going to fetch a list of numbers that starts with "0032" from a file with a format like the given below: " 0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 0032459999 0032458888 0032457777 0032451111 0032452222 0032453333 " I want to get a unique... (6 Replies)
Discussion started by: tinku
6 Replies

9. UNIX for Dummies Questions & Answers

To get unique numbers from two files

here i have two files: file 1 1 2 3 4 5 5 6 7 8 9 file 2 4 5 6 6 8 8 (6 Replies)
Discussion started by: i.scientist
6 Replies

10. Shell Programming and Scripting

Shell script to check the unique numbers in huge data

Friends, I have to write a shell script,the description is---- i Have to check the uniqueness of the numbers in a file. A file is containing 200thousand tickets and a ticket have 15 numbers in asecending order.And there is a strip that is having 6 tickets that means 90 numbers.I... (7 Replies)
Discussion started by: namishtiwari
7 Replies
Login or Register to Ask a Question