File mttroot/mtt/bin/trans/abg2cr_m2txt artifact 66557e28d3 part of check-in 4be02de99d


#! /bin/sh

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

# Bourne shell script: abg2cr_m2txt

# Abg file to constitutive relationship conversion
# P.J.Gawthrop march 2000
# Copyright (C) 2000 by Peter J. Gawthrop



# Inform user
if [ "$1_cr.txt" -nt "$1_abg.m" ]; then
    echo "Using  $1_cr.txt"
    exit
else
    echo "Creating $1_cr.txt"
fi


rm -f mtt_error


# This is the main transformation using awk 
# And remove crs with same name as system
grep 'cr = ' $1_abg.m | gawk '
BEGIN {
# Include lin cr anyway.
print "lin"
}
{
  crs=substr($3,2,length($3)-3);
    N=split(crs,cr,";");
      for (i=1;i<=N;i++){
        if (length(cr[i])>0)
        print cr[i];
      }
}'  2>mtt_error.txt | sort -u | grep -v none | grep -v '\$[0-9]'> $1_cr.txt

# Now invoke the standard error handling.
mtt_error mtt_error.txt






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