#!/usr/bin/perl
#
while (<>) {
if (/INT/) {
 /^ (....)/;
 $nomres=substr($1."    ", 0, 4);
 while (!/DUMM/) {
 $_=<>;
 };
 while ( /[A-z]/) {
    @dades=split ' ';
    $nomat=substr($dades[1]."    ", 0, 4);
    $tipat=substr($dades[2]."    ", 0, 4);
#substitucions
    $tipat =~ s/([C|N|O|S])./$1 /g;
    $tipat =~ s/H /HN/g;
    $tipat =~ s/H[1|2|3|C|P|A|4|5]/H /g;
    $tipat =~ s/HS/HN/g;
    $carat=$dades[10];
    printf "%s %8.4f\n", "$nomres $nomat $tipat", $carat if ($nomat ne "DUMM");
    $_=<>;
 };
};
}; 
    
