Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Removing rows that contain non-unique column entry Post 302924198 by msatseqs on Thursday 6th of November 2014 10:34:25 PM
Old 11-06-2014
Removing rows that contain non-unique column entry

Background:
I have a file of thousands of potential SSR primers from Batch Primer 3.
I can't use primers that will contain the same sequence ID or sequence as another primer.
I have some basic shell scripting skills, but not enough to handle this.

What you need to know:
I need to remove the entire line(row) if its entry in column 3 or 13 is not unique when compared to the rest of its column. Or, I need to cat all lines that have a unique entry in columns 3 and 13 to a new file.

Note: I can't just remove the duplicate value, I have to remove the whole row after checking a value in that row against the rest of its column.

Example data is attached. Red values are duplicates.

Thank you very very very much!
Removing rows that contain non-unique column entry-example-msat-datapng
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing the rest of line from the second entry of an expression

Dear people, can you please enlighten: I need to do a (most probably) very simple thing but couldn't figure how. I have files with lots of lines starting with a fixed expression: Query=. (the dot is a space) followed by different combinations of characters including special ones such... (5 Replies)
Discussion started by: roussine
5 Replies

2. Shell Programming and Scripting

for each different entry in column 1 extract maximum values from column 2 in unix/awk

Hello, I have 2 columns (1st column has multiple entries but the corresponding values in the column 2 may be the same or different.) however I want to extract unique values for each entry in column 1 by assigning the max value from column 2 SDF4 -0.211654 SDF4 0.978068 ... (1 Reply)
Discussion started by: Diya123
1 Replies

3. Shell Programming and Scripting

Rename a header column by adding another column entry to the header column name URGENT!!

Hi All, I have a file example.csv which looks like this GrpID,TargetID,Signal,Avg_Num CSCH74_1_1,2007,61,256 CSCH74_1_1,212007,647,679 CSCH74_1_1,12007,3,32 CSCH74_1_1,207,299,777 I want the output as GrpID,TragetID,Signal-CSCH74_1_1,Avg_Num CSCH74_1_1,2007,61,256... (4 Replies)
Discussion started by: Vavad
4 Replies

4. Shell Programming and Scripting

unique entry add values

Hi, I have a file with 3 columns ABC 3 1 ABC 5 1 XYZ 4 2 DEF 3 2 DEF 4 1 DEF 6 1 MNO 5 5 JKL 3 2 JKL 4 2 PQR 12 1 For each unique entry in column 1 I want to add values in column 2 and column3 o/p ABC 8 2 XYZ 4 2 (1 Reply)
Discussion started by: Diya123
1 Replies

5. UNIX for Dummies Questions & Answers

Delete rows with unique value for specific column

Hi all I have a file which looks like this 1234|1|Jon|some text|some text 1234|2|Jon|some text|some text 3453|5|Jon|some text|some text 6533|2|Kate|some text|some text 4567|3|Chris|some text|some text 4567|4|Maggie|some text|some text 8764|6|Maggie|some text|some text My third column is my... (9 Replies)
Discussion started by: A-V
9 Replies

6. UNIX for Dummies Questions & Answers

merging rows into new file based on rows and first column

I have 2 files, file01= 7 columns, row unknown (but few) file02= 7 columns, row unknown (but many) now I want to create an output with the first field that is shared in both of them and then subtract the results from the rest of the fields and print there e.g. file 01 James|0|50|25|10|50|30... (1 Reply)
Discussion started by: A-V
1 Replies

7. Shell Programming and Scripting

Delete unique rows - optimize script

Hi all, I have the following input - the unique row key is 1st column cat file.txt A response C request C response D request C request C response E request The desired output should be C request (7 Replies)
Discussion started by: varu0612
7 Replies

8. Shell Programming and Scripting

Unique extraction of rows

I do have a tab delimited file of the following format: 431 kat1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 432 kat2 2 NA NA NA NA NA NA NA NA NA NA NA NA NA 433 KATe NA 3 NA NA 6 NA NA NA 10 11 NA NA NA NA 542 Kaed 2 NA NA NA NA NA NA NA NA NA NA NA NA NA 543 hkwuy NA NA NA NA 6 NA NA NA NA 11 NA NA... (11 Replies)
Discussion started by: Kanja
11 Replies

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

10. UNIX for Beginners Questions & Answers

Awk/sed summation of one column based on some entry in first column

Hi All , I am having an input file as stated below Input file 6 ddk/djhdj/djhdj/Q 10 0.5 dhd/jdjd.djd.nd/QB 01 0.5 hdhd/jd/jd/jdj/Q 10 0.5 512 hd/hdh/gdh/Q 01 0.5 jdjd/jd/ud/j/QB 10 0.5 HD/jsj/djd/Q 01 0.5 71 hdh/jjd/dj/jd/Q 10 0.5 ... (5 Replies)
Discussion started by: kshitij
5 Replies
DB2_SPECIAL_COLUMNS(3)							 1						    DB2_SPECIAL_COLUMNS(3)

db2_special_columns - Returns a result set listing the unique row identifier columns for a table

SYNOPSIS
resource db2_special_columns (resource $connection, string $qualifier, string $schema, string $table_name, int $scope) DESCRIPTION
Returns a result set listing the unique row identifier columns for a table. PARAMETERS
o $connection - A valid connection to an IBM DB2, Cloudscape, or Apache Derby database. o $qualifier - A qualifier for DB2 databases running on OS/390 or z/OS servers. For other databases, pass NULL or an empty string. o $schema - The schema which contains the tables. o $table_name - The name of the table. o $scope - Integer value representing the minimum duration for which the unique row identifier is valid. This can be one of the following values: +--------------+--------------------------------------+---+ |Integer value | | | | | | | | | SQL constant | | | | | | | | Description | | | | | | +--------------+--------------------------------------+---+ | 0 | | | | | | | | | SQL_SCOPE_CURROW | | | | | | | | Row identifier is valid only while | | | | the cursor is positioned on the row. | | | | | | | 1 | | | | | | | | | SQL_SCOPE_TRANSACTION | | | | | | | | Row identifier is valid for the | | | | duration of the transaction. | | | | | | | 2 | | | | | | | | | SQL_SCOPE_SESSION | | | | | | | | Row identifier is valid for the | | | | duration of the connection. | | | | | | +--------------+--------------------------------------+---+ RETURN VALUES
Returns a statement resource with a result set containing rows with unique row identifier information for a table. The rows are composed of the following columns: +------------+---------------------------------------------------+ |Column name | | | | | | | Description | | | | +------------+---------------------------------------------------+ | SCOPE | | | | | | | | | | | | | box, tab (|); c | c | c | . T{ Integer | | | value | | | | | | SQL constant | | | | | | Description | | | | +------------+---------------------------------------------------+ | 0 | | | | | | | SQL_SCOPE_CURROW | | | | | | Row identifier is valid only while the cursor is | | | positioned on the row. | | | | | 1 | | | | | | | SQL_SCOPE_TRANSACTION | | | | | | Row identifier is valid for the duration of the | | | transaction. | | | | | 2 | | | | | | | SQL_SCOPE_SESSION | | | | | | Row identifier is valid for the duration of the | | | connection. | | | | +------------+---------------------------------------------------+ T} T{ COLUMN_NAME T} |T{ Name of the unique column. T} T{ DATA_TYPE T} |T{ SQL data type for the column. T} T{ TYPE_NAME T} |T{ Character string representation of the SQL data type for the column. T} T{ COLUMN_SIZE T} |T{ An integer value representing the size of the column. T} T{ BUFFER_LENGTH T} |T{ Maximum number of bytes necessary to store data from this column. T} T{ DECIMAL_DIGITS T} |T{ The scale of the column, or NULL where scale is not applicable. T} T{ NUM_PREC_RADIX T} |T{ An integer value of either 10 (representing an exact numeric data type), 2 (representing an approximate numeric data type), or NULL (rep- resenting a data type for which radix is not applicable). T} T{ PSEUDO_COLUMN T} |T{ Always returns 1. T} SEE ALSO
db2_column_privileges(3), db2_columns(3), db2_foreign_keys(3), db2_primary_keys(3), db2_procedure_columns(3), db2_procedures(3), db2_sta- tistics(3), db2_table_privileges(3), db2_tables(3). PHP Documentation Group DB2_SPECIAL_COLUMNS(3)
All times are GMT -4. The time now is 07:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy