Skip to content

Instantly share code, notes, and snippets.

@gawbul
Created December 9, 2013 22:33
Show Gist options
  • Save gawbul/7882212 to your computer and use it in GitHub Desktop.
Save gawbul/7882212 to your computer and use it in GitHub Desktop.
A script to parse a RAD tags file and display the line number and individual id/tag id pairs field when the field has only a specific number of individuals (in the case n==3)
BEGIN {
FS="\t"
}
{
lena=split($9,a,",")
for (i=1;i<=lena;i++) {
split(a[i],b,"_")
freq[NR][b[1]]++
}
}
END {
for (j in freq) {
n=0
for (k in freq[j])
n++;
if (n == 3)
print NR, ":", $9
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment