I've been trying to figure out a way to select lines that are unique based on the values of two columns. For example, here is a sample/example of my file:
chr1 10 12
chr1 10 12
chr1 10 11
chr1 9 12
chr2 15 20
And this is what I want my output to look like:
chr1 10 12
chr1 10 11
chr1 9 12
chr2 15 20
I've tried to use this code because I like how it doesn't mess with the order of my file:
awk -F"\t" '!_[$2]++' SNP_positions.txt > SNP_positions_uniq.txt
However, it only captures unique features of one column. Is there a way to edit this to make it work for two columns?
_
as a variable name is an idiot, do not listen to them any more. We all know that single-letter variable names are best avoided in general as they do nothing to improve the clarity of your code, but using something that's not even a letter is just ridiculous.