I have a tab delimited .txt file and want to delete rows that have duplications in the first column. If this can be done without sort, that would be amazing, but I've kind of come to terms with that I have to use sort. If I use sort, the header can not be sorted, it has to stay on top.
test dataset, (tab delimited):
Symbol ATCACGACAGACAGGT.1 ATCACGACAGCCTATA.1 TTTGTCATCATGTCTT.1 STPG1 0 1 3 NFYA 0 0 1 STPG1 1 3 1 ABD 0 0 0 ABC 0 0 0
My dream output:
Symbol ATCACGACAGACAGGT.1 ATCACGACAGCCTATA.1 TTTGTCATCATGTCTT.1 STPG1 0 1 3 NFYA 0 0 1 ABD 0 0 0 ABC 0 0 0
My next best output:
Symbol ATCACGACAGACAGGT.1 ATCACGACAGCCTATA.1 TTTGTCATCATGTCTT.1 ABC 0 0 0 ABD 0 0 0 NFYA 0 0 1 STPG1 0 1 3
I managed to use the following code on comma delimited test sample, testc.txt, except that the header is still in the sort. I can't seem to figure out a way to assign a tab delimiter that works? Also, having trouble with the header in this code as well:
sort -u -t, -k1,1 testc.txt
Maybe I should clarify that I do not know the number of rows, columns or what the row names are in my real data set.