#!/usr/bin/nawk -f BEGIN { a=0 r1 = 500 a1 = "OO" a2 = "Z" a3 = "X" a4 = "Y" #set for NH or CH #a5 = "CA" #a6 = "HA" a5 = "N" a6 = "HN" } FILENAME==ARGV[1] { a++ r3[a]=$1 dJ[a]=$2 #erJ[a]=0.20 erJ[a]=1.0 } END { for (i=1; i<=a; i++) { printf"assign ( resid %-4d and name %-3s )\n", r1, a1 printf" ( resid %-4d and name %-3s )\n", r1, a2 printf" ( resid %-4d and name %-3s )\n", r1, a3 printf" ( resid %-4d and name %-3s )\n", r1, a4 printf" ( resid %-4d and name %-3s )\n", r3[i], a5 printf" ( resid %-4d and name %-3s ) ", r3[i], a6 printf"%4.1f %4.1f\n\n", dJ[i], erJ[i] } }