#!/usr/bin/nawk -f BEGIN { a=0 r1 = 500 a1 = "OO" a2 = "Z" a3 = "X" a4 = "Y" erJ = 1.0 atom1="N" atom2="HN" } FILENAME==ARGV[1] { a++ res1[a]=$1 dJ[a]=$2 } 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", res1[i], atom1 printf" ( resid %-4d and name %-3s ) ", res1[i], atom2 printf"%3.4f %2.4f %2.4f\n\n", dJ[i], erJ, erJ } }