Sponsored Content
Top Forums Shell Programming and Scripting Count of unique lines in field 4 Post 302960219 by cmccabe on Thursday 12th of November 2015 10:59:00 AM
Old 11-12-2015
Using the perl and awk commands both produced the same result 56,543, so that means that 5 id's are not there. I was going to pull out the the unique entries in that field but the below seems to be printing the entire line. Thank you Smilie.

Code:
awk 'a !~ $4; {a=$4}' Input.txt

Desired output
Code:
chr1:955543-955763 
chr1:957571-957852 
chr1:970621-970740

Thank you Smilie.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare Tab Separated Field with AWK to all and print lines of unique fields.

Hi. I have a tab separated file that has a couple nearly identical lines. When doing: sort file | uniq > file.new It passes through the nearly identical lines because, well, they still are unique. a) I want to look only at field x for uniqueness and if the content in field x is the... (1 Reply)
Discussion started by: rocket_dog
1 Replies

2. Shell Programming and Scripting

Unique Field

I have this input file tilenet_test:clar_r5_performance:server_2:4.80762:0%:APM00083103999-009E,APM00083103999-009F tilenet_int:clar_r5_performance:server_2:4.80762:0%:APM00083103999-00C4... (3 Replies)
Discussion started by: greycells
3 Replies

3. UNIX for Dummies Questions & Answers

Print unique lines without sort or unique

I would like to print unique lines without sort or unique. Unfortunately the server I am working on does not have sort or unique. I have not been able to contact the administrator of the server to ask him to add it for several weeks. (7 Replies)
Discussion started by: cokedude
7 Replies

4. Shell Programming and Scripting

awk to count using each unique value

Im looking for an awk script that will take the unique values in column 5, then print and count the unique values in column 6. CA001011500 11111 11111 -9999 201301 AAA CA001012040 11111 11111 -9999 201301 AAA CA001012573 11111 11111 -9999 201301 BBB CA001012710 11111 11111 -9999 201301... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

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

6. Shell Programming and Scripting

awk joining multiple lines based on field count

Hi Folks, I have a file with fields as follows which has last field in multiple lines. I would like to combine a line which has three fields with single field line for as shown in expected output. Please help. INPUT hname01 windows appnamec1eda_p1, ... (5 Replies)
Discussion started by: shunya
5 Replies

7. Shell Programming and Scripting

awk to remove lines where field count is greather than 1 in two fields

I am trying to remove all the lines and spaces where the count in $4 or $5 is greater than 1 (more than 1 letter). The file and the output are tab-delimited. Thank you :). file X 5811530 . G C NLGN4X 17 10544696 . GA G MYH3 9 96439004 . C ... (1 Reply)
Discussion started by: cmccabe
1 Replies

8. UNIX for Beginners Questions & Answers

Count unique column

Hello, I am trying to count unique rows in my file based on 4 columns (2-5) and to output its frequency in a sixth column. My file is tab delimited My input file looks like this: Colum1 Colum2 Colum3 Colum4 Coulmn5 1.1 100 100 a b 1.1 100 100 a c 1.2 200 205 a d 1.3 300 301 a y 1.3 300... (6 Replies)
Discussion started by: nans
6 Replies

9. UNIX for Beginners Questions & Answers

Print lines based upon unique values in Nth field

For some reason I am having difficulty performing what should be a fairly easy task. I would like to print lines of a file that have a unique value in the first field. For example, I have a large data-set with the following excerpt: PS003,001 MZMWR/ L-DWD// * PS003,001... (4 Replies)
Discussion started by: jvoot
4 Replies

10. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
wsreg_set_unique_name(3WSREG)			    Product Install Registry Library Functions			     wsreg_set_unique_name(3WSREG)

NAME
wsreg_set_unique_name, wsreg_get_unique_name - set or get the unique name of a component SYNOPSIS
cc [flag ...] file ...-lwsreg [library ...] #include <wsreg.h> int wsreg_set_unique_name(Wsreg_component *comp, const char *unique_name); char *wsreg_get_unique_name(const Wsreg_component *comp); DESCRIPTION
The wsreg_set_unique_name() function sets the unique name specified by unique_name in the component specified by comp. Every component must have a unique name before being registered. If a unique name has already been set in the specified component, the resources associ- ated with the previously set unique name are released. The wsreg_get_unique_name() function gets the unique name string from the component specified by comp. The resulting string must be released by the caller. RETURN VALUES
The wsreg_set_unique_name() function returns a non-zero value if the unique name was set correctly; otherwise it returns 0. The wsreg_get_unique_name() function returns a copy of the unique name from the specified component. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
wsreg_initialize(3WSREG), attributes(5) SunOS 5.10 22 Sep 2000 wsreg_set_unique_name(3WSREG)
All times are GMT -4. The time now is 05:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy