#!/usr/bin/awk -f BEGIN{ ### Read table names of fixed assignment and chemical shift tables while(getline < ARGV[1] >0){ if($1=="fixAss:"){ tablename = $2 } }close(ARGV[1]) ### Read the fixed assignment table if(tablename != "NO"){ while(getline < tablename >0) if($1 !~ /^#/ && NF>=2){ count = 0 for(i=2;i<=NF;i++) if ($i ~ /[0-9]/){ count++ } if(count == 1){ for(i=2;i<=NF;i++) if ($i ~ /[0-9]/){ fixedPR[$i] = $1 } } }close(tablename) } ### Read the assignment_AA.out and print out assignment_AA_label.out. while(getline < "assignment_AA.out" >0){ Degree = $3 PR_id = $2 AA_id = substr($1,5,length($1)-4) if(fixedPR[AA_id] != 0){ Degree = "(F)" PR_id = fixedPR[AA_id] } printf "%-10s %s %s\n", $1, PR_id, Degree > "assignment_AA_label.out" }close("assignment_AA.out") com = "mv assignment_AA_label.out assignment_AA.out" system(com) close(com) }