Hi,
I want to match and print columns that match.
So my file looks like this:
h1 20 30 h1 25 27
h2 50 70 h2 90 95
h2 60 80 h2 70 75
h3 130 150 h3 177 190
h4 140 190 h4 300 305
So there are 6 columns. Column 1 and 4 are names. I am able to get the names to match up into rows. But what I want to do next is match columns 2,3,5 and 6. So if columns 2-3 overlap wiht 5-6 then I want to print that line (eg. values 20-30 overlap with 25-27 so they print. But on row 5, 140-190 does not overlap with 300-305 so it wont print).
So the output will look like this:
h1 20 30 h1 25 27
h2 60 80 h2 70 75
h4 140 190 h4 300 305
Basically I have this... it can match columns 1 and 4 but I cant get the other columns to match.
awk -F"\t" '$1==$4 {print $0} ' file1.txt > output.txt
thanks