#!/usr/local/bin/nawk -f # substitute numbers for atom names # read carfile and generate associative array to map atom names to numbers function atom_number_array(carfile,array, nr,offset){ # read carfile nr = 0 offset = 1 while ( getline " exit } atom_number_array(c,numberarray) } { for ( i=1 ; i<= NF ; ++i ) if ( $i in numberarray ) $i = numberarray[$i] print }