File mttroot/mtt/bin/trans/lbl2icd_txt2txt.sh artifact 90cc5ce192 part of check-in 0c40464f88


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: lbl2icd_txt2txt
# Creates the component ICDs in text form

# Adapted from lbl2alias_txt2txt

sys=$1
icd=${sys}_icd.txt
lbl=${sys}_lbl.txt

# Inform user
echo Creating ${icd}

#Create the ICD file complete with headers.
echo "# Component ICD file ($1_icd.txt)" > ${icd}
echo "# Generated by MTT at `date`" >> ${icd}

#Write out the variables 
    grep '[%|#]ICD' ${lbl} |\
    awk '{
      if (match($3,"/")==0){
        if (match($2,"\\$")==0){
          icd=$2; name =$3
        }
        else{
          icd=$3; name =$2
        }
        n=split(icd,a,"|");
        for (i=1; i<=n; i++)
          print a[i] "\t" name;
	   }
      }
      END{
      print "###_END_OF_ICD_###"
     }' >> ${icd}


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]