#!/bin/awk -f #awk script to calculate the exposed surface area for a particular residue #M. Nelson 2/25/97 #command line: res_surf res=value inputfile #res is the number of the residue you want the surface area for #it is necessary to redirect output to a file BEGIN{ mod_count = 0 } { if ($3 == res){ surf_area = surf_area + $5 } if ($4 == "WMAX"){ mod_count = mod_count + 1 surf_array[mod_count] = surf_area print "Surface area for residue "res" in model "mod_count" = "surf_area surf_area = 0 } } END{ for( x = 1; x <= mod_count; x++){ surf_ave_tot += surf_array[x] } surf_ave = surf_ave_tot / mod_count print "Average surface area for residue "res" = "surf_ave }