File mttroot/mtt/bin/trans/numpar2subs_txt2r artifact 7658495930 part of check-in edda44204d


#! /bin/sh

  ###################################### 
  ##### Model Transformation Tools #####
  ######################################
  
## Makes algebraic substitution file from numpar file.
## Omitting all parameter in 2nd argument

  ###############################################################
  ## Version control history
  ###############################################################
  ## $Id$
  ## $Log$
  ## Revision 1.1  2002/11/14 05:48:53  gawthrop
  ## Useful utility not yet in mtt
  ##
  ###############################################################

# Copyright (C) 2002 by Peter J. Gawthrop

sys=$1
pars=$2

outfile=${sys}_subs.r
infile=${sys}_numpar.txt

echo Creating ${outfile} from ${infile}
cat<<EOF > ${outfile}_1
%% File ${outfile} generated on `date` from  ${infile}
%% All parameters replaced by numbers except for:
%%   ${pars}

EOF

sed 's/#/%/g' < ${infile} | sed 's/=/:=/' >> ${outfile}_1

cat >> ${outfile}_1 <<EOF
ON ROUNDED; %% Floating point
END;
EOF

gawk '
{
N=split(pars,par);
matched=0;
for (i=1;i<=N;i++)
  if ($1==par[i]) 
    matched=1;

if (!matched) print $0
}' pars="$pars" < ${outfile}_1 > ${outfile}

rm ${outfile}_1



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