How to sort for unique values in a certain row?
1
0
Entering edit mode
6.7 years ago
Bweil2 ▴ 10

How can I sort only the first column and only include unique values? ...I want the first three rows to only be 1. AT1G01080.

AT1G01080|AT1G01080.  286   0.975  0.048  0.003  0.037   C    1
AT1G01080|AT1G01080.  293   0.975  0.048  0.003  0.037   C    1
AT1G01080|AT1G01080.  294   0.975  0.048  0.003  0.037   C    1
AT1G01090|AT1G01090.  428   0.962  0.121  0.003  0.038   C    1
AT1G01250|AT1G01250.  192   0.736  0.079  0.031  0.246   C    3
AT1G01520|AT1G01520.  258   0.559  0.128  0.222  0.120   C    4
AT1G01520|AT1G01520.  287   0.559  0.128  0.222  0.120   C    4
AT1G01550|AT1G01550.  349   0.805  0.215  0.015  0.092   C    3
AT1G01690|AT1G01690.  450   0.685  0.105  0.005  0.160   C    3
AT1G01690|AT1G01690.  450   0.766  0.100  0.004  0.136   C    2
sequencing gene • 1.0k views
ADD COMMENT
0
Entering edit mode
sort -uk1,1 file

This worked for me

ADD REPLY
0
Entering edit mode

If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted. Upvote|Bookmark|Accept

ADD REPLY
1
Entering edit mode
6.7 years ago

look at option -u of sort ... http://man7.org/linux/man-pages/man1/sort.1.html

ADD COMMENT

Login before adding your answer.

Traffic: 2345 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6