Hello,
I'm a newbie to awk and trying to teach myself to do basic lookups in sequencing data files from command line. I have a file with two columns which correspond to start and stop positions of genes. I want to print the lines (genes) that have overlap with other genes in the file based on the start and stop positions (columns 1 and 2) so that I can simply see which genes positions have overlap. Are there any suggestions for an awk based approach to quickly accomplish this?
I tried the following with no luck
awk '{prev=$0; b1=$1; b2=$2; getline if ($1 >= b1 && $2 <= b2) print prev}' filename
Any insight or suggestions would be appreciated - I may have some syntax errors here to work through.
I'm a newbie to awk and trying to teach myself to do basic lookups in sequencing data files from command line. I have a file with two columns which correspond to start and stop positions of genes. I want to print the lines (genes) that have overlap with other genes in the file based on the start and stop positions (columns 1 and 2) so that I can simply see which genes positions have overlap. Are there any suggestions for an awk based approach to quickly accomplish this?
I tried the following with no luck
awk '{prev=$0; b1=$1; b2=$2; getline if ($1 >= b1 && $2 <= b2) print prev}' filename
Any insight or suggestions would be appreciated - I may have some syntax errors here to work through.
Comment