Skip to content

Instantly share code, notes, and snippets.

@keg
Created July 21, 2014 01:46
Show Gist options
  • Select an option

  • Save keg/86e0efd7673df5759ba0 to your computer and use it in GitHub Desktop.

Select an option

Save keg/86e0efd7673df5759ba0 to your computer and use it in GitHub Desktop.
#!/bin/bash
awk '{
if(FNR==NR){
a[$1,$2]=$2;
next
}
for (b in a){
split(b,c,SUBSEP);
if(c[1] == $1 && a[b] >= $4 && a[b] <= $5){
printf "%s\t%s\t%s\n", c[1], a[b], $10
delete a[b]
next
}
}
}' $1 $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment