Believe it or not, I’ve searched all over the internet and haven’t found a working solution for this problem in AWK.
I have two files, A and B:
File A:
chr1 pos1
chr1 pos2
chr2 pos1
chr2 pos2
File B:
chr1 pos1
chr2 pos1
chr3 pos2
Desired Output:
chr1 pos1
chr2 pos1
I’d like to join these two files to basically get the intersection between the two files based on the first AND second columns, not just the first. Since this is the case, most simple scripts won’t work and join doesn’t seem to be an option.
Any ideas?
EDIT: sorry, I didn’t mention that there are more columns than just the two I showed. I’ve only shown two in my example because I’m only interested in the first two columns between both files being identical, the rest of the data aren’t important (but are nonetheless in the file)
Hum, my idea is the following:
Use
jointo merge the two files and correct with awkEdit: given the edit, the join solution may still work (with options), so the concept remains correct (imo).