pid2gid.awk 405 B

12345678910111213141516171819202122232425
  1. BEGIN{
  2. FS=OFS="\t"
  3. }
  4. FNR==NR{
  5. if(!a[$2]){
  6. a[$2]=$1
  7. }else{
  8. a[$2]=a[$2]";"$1
  9. }
  10. }
  11. FNR!=NR{
  12. if(a[$1] && a[$2]){
  13. split(a[$1],g1,";")
  14. split(a[$2],g2,";")
  15. for(i1 in g1){
  16. for(i2 in g2){
  17. if(g1[i1] != g2[i2]){
  18. print g1[i1],g2[i2],$3,$4,$5,$6,$7,$8,$9,$10
  19. }
  20. }
  21. }
  22. }
  23. }